-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.php
More file actions
62 lines (61 loc) · 1.54 KB
/
compose.php
File metadata and controls
62 lines (61 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php //compose.php
require_once "conn.php";
$title="";
$body="";
$article="";
$author_id="";
if(isset($_GET["a"])
and $_GET["a"] == "edit"
and isset($_GET["article"])
and $_GET["article"])
{
$sql = "SELECT title, body, author_id FROM cms_articles " .
"WHERE article_id=" .$_GET["article"];
$result = mysql_query($sql, $conn)
or die("Couldn't retrieve article data: " . mysql_error());
$row = mysql_fetch_array($result);
$title = $row["title"];
$body = $row["body"];
$article = $_GET["article"];
$author_id = $row["author_id"];
mysql_close($conn);
}
require_once "header.php";
?>
<form method="post" action="transact-article.php">
<h2>Compose Article</h2>
<p>
Title: <br/>
<input type="text" class="title" name="title" maxlength="255" value="<?php echo htmlspecialchars($title); ?>"/>
</p>
<p>
Body: <br/>
<textarea class="body" name="body" rows="10" cols="60"><?php echo htmlspecialchars($body);?></textarea>
<!--CKEDIT-->
<script type="text/javascript">
CKEDITOR.replace("body");
</script>
</p>
<p>
<?php
echo "<input type='hidden' name='article' value='" .
$article . "\' />\n";
if($_SESSION["access_lvl"] < 2)
{
echo "<input type='hidden' name='authorid' value='" .
$author_id . "\' />";
}
if($article)
{
echo "<input type='submit' class='submit' name='action' " .
"value=\"Save Changes\" />";
}
else
{
echo "<input type='submit' class='submit' name='action' " .
"value=\"Submit New Article\" />";
}
?>
</p>
</form>
<?php require_once "footer.php" ?>