-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpanel.php
More file actions
94 lines (94 loc) · 2.76 KB
/
cpanel.php
File metadata and controls
94 lines (94 loc) · 2.76 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
require_once "conn.php";
require_once "header.php";
$sql = "SELECT name, email, age, hometown, bio " .
"FROM cms_users " .
"WHERE user_id=" . $_SESSION["user_id"];
$result = mysql_query($sql, $conn)
or die("Couldn't look up user data: " . mysql_error());
$user = mysql_fetch_array($result);
?>
<form method="post" action="transact-user.php">
<p>
Name: <br/>
<input type="text" id="name" name="name" value="<?php echo htmlspecialchars($user["name"]); ?>"/>
</p>
<p>
Email <br/>
<input type="text" id="email" name="email" value="<?php echo htmlspecialchars($user["email"]); ?>"/>
</p>
<p>
Age: <br/>
<input type="text" class="textInput" name="age" maxlength="3" value="<?php echo htmlspecialchars($user["age"]);?>" />
</p>
<p>
Hometown: <br/>
<input type="text" class="textInput" name="hometown" maxlength="255" value="<?php echo htmlspecialchars($user["hometown"]);?>" />
</p>
<p>
Bio(500 char max): <br/>
<textarea name="bio" class="textarea" rows="4" cols="50" maxlength="500"><?php echo htmlspecialchars($user["bio"]); ?></textarea>
</p>
<p>
<input type="submit" class="submit" name="action" value="Change my info" />
</p>
</form>
<h1>Pending Articles</h1>
<div class="scroller">
<table>
<?php
$sql = "SELECT article_id, title, date_submitted " .
"FROM cms_articles " .
"WHERE is_published=0 " .
"AND author_id=" . $_SESSION["user_id"] . " " .
"ORDER BY date_submitted";
$result = mysql_query($sql, $conn)
or die("Couldn't get list of pending articles: " . mysql_error());
if(mysql_num_rows($result) == 0) {
echo "<em>There are no pending articles</em>.";
} else {
while($row=mysql_fetch_array($result)) {
echo "<tr>\n";
echo "<td><a href='reviewarticle.php?article=" .
$row["article_id"] . "'>" . htmlspecialchars($row["title"]) .
"</a> (Submitted " .
date("F j, Y", strtotime($row["date_submitted"])) .
")</td>\n";
echo "</tr>\n";
}
}
?>
</table>
</div>
<br/>
<h2>Published Stories</h2>
<div class="scroller">
<table>
<?php
$sql = "SELECT article_id, title, date_published " .
"FROM cms_articles " .
"WHERE is_published=1 " .
"AND author_id=" . $_SESSION["user_id"] . " " .
"ORDER BY date_submitted";
$result = mysql_query($sql, $conn)
or die("Couldn't get list of published articles: " . mysql_error());
if(mysql_num_rows($result) == 0) {
echo "<em>There are no published articles</em>.";
} else {
while($row=mysql_fetch_array($result)) {
echo "<tr>\n";
echo "<td><a href='viewarticle.php?article=" .
$row["article_id"] . "'>" . htmlspecialchars($row["title"]) .
"</a> (published " .
date("F j, Y", strtotime($row["date_published"])) .
")</td>\n";
echo "</tr>\n";
}
}
?>
</table>
</div>
<br/>
<?php
mysql_close($conn);
require_once "footer.php" ?>