diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-21 10:26:52 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-21 10:26:52 -0500 |
commit | 98be190dd56ff7fa422311f910e700069568db4c (patch) | |
tree | 621fb6cd794772bfaecff735883114731a3ef8d6 /pages | |
parent | 4f1cb78e3c3c1ecf568c275fad139fed94b24c35 (diff) | |
download | fourisland-98be190dd56ff7fa422311f910e700069568db4c.tar.gz fourisland-98be190dd56ff7fa422311f910e700069568db4c.tar.bz2 fourisland-98be190dd56ff7fa422311f910e700069568db4c.zip |
Added comment editing and deleting
Diffstat (limited to 'pages')
-rw-r--r-- | pages/delete-comment.php | 54 | ||||
-rw-r--r-- | pages/edit-comment.php | 54 |
2 files changed, 108 insertions, 0 deletions
diff --git a/pages/delete-comment.php b/pages/delete-comment.php new file mode 100644 index 0000000..f8d1936 --- /dev/null +++ b/pages/delete-comment.php | |||
@@ -0,0 +1,54 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/delete-comment.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | if (!isset($_GET['id'])) | ||
26 | { | ||
27 | generateError('404'); | ||
28 | } else { | ||
29 | if (isLoggedIn()) | ||
30 | { | ||
31 | $getcomment = "SELECT * FROM comments WHERE id = " . $_GET['id']; | ||
32 | $getcomment2 = mysql_query($getcomment); | ||
33 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
34 | |||
35 | if ($getcomment3['id'] == $_GET['id']) | ||
36 | { | ||
37 | if ((isAdmin()) || (($getcomment3['is_anon'] == 0) && (getSessionUserID() === $getcomment3['user_id']))) | ||
38 | { | ||
39 | $delcomment = "DELETE FROM comments WHERE id = " . $_GET['id']; | ||
40 | $delcomment2 = mysql_query($delcomment); | ||
41 | |||
42 | header('Location: ' . getCommentUrl($getcomment3)); | ||
43 | } else { | ||
44 | generateError('404'); | ||
45 | } | ||
46 | } else { | ||
47 | generateError('404'); | ||
48 | } | ||
49 | } else { | ||
50 | generateError('404'); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | ?> | ||
diff --git a/pages/edit-comment.php b/pages/edit-comment.php new file mode 100644 index 0000000..92a1aba --- /dev/null +++ b/pages/edit-comment.php | |||
@@ -0,0 +1,54 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/edit-comment.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | if (!isset($_GET['id']) || !isset($_POST['comment'])) | ||
26 | { | ||
27 | generateError('404'); | ||
28 | } else { | ||
29 | if (isLoggedIn()) | ||
30 | { | ||
31 | $getcomment = "SELECT * FROM comments WHERE id = " . $_GET['id']; | ||
32 | $getcomment2 = mysql_query($getcomment); | ||
33 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
34 | |||
35 | if ($getcomment3['id'] == $_GET['id']) | ||
36 | { | ||
37 | if ((isAdmin()) || (($getcomment3['is_anon'] == 0) && (getSessionUserID() === $getcomment3['user_id']))) | ||
38 | { | ||
39 | $setcomment = "UPDATE comments SET comment = \"" . mysql_real_escape_string($_POST['comment']) . "\" WHERE id = " . $_GET['id']; | ||
40 | $setcomment2 = mysql_query($setcomment); | ||
41 | |||
42 | header('Location: ' . getCommentUrl($getcomment3) . '#comment-' . $getcomment3['id']); | ||
43 | } else { | ||
44 | generateError('404'); | ||
45 | } | ||
46 | } else { | ||
47 | generateError('404'); | ||
48 | } | ||
49 | } else { | ||
50 | generateError('404'); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | ?> | ||