summaryrefslogtreecommitdiff
path: root/mod.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-02-05 15:43:42 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-02-05 15:43:42 +1100
commita3d22a79b7fc41f566f3ee07e1be4cc5b2108163 (patch)
tree2b8e4f0f27ced2180331ed6ec4ec9bd0ccdc021d /mod.php
parent5b8ace603e75c736d62fbbe572696cfc2729d6d7 (diff)
Delete by IP
Diffstat (limited to 'mod.php')
-rw-r--r--mod.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/mod.php b/mod.php
index 04b758f6..c67bfd66 100644
--- a/mod.php
+++ b/mod.php
@@ -357,14 +357,21 @@
if(!openBoard($boardName))
error(ERROR_NOBOARD);
- $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri']));
- $query->bindValue(':ip', $ip);
+ $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = (SELECT `ip` FROM `posts_%s` WHERE `id` = :id)", $board['uri'], $board['uri']));
+ $query->bindValue(':id', $post);
$query->execute() or error(db_error($query));
- //if(isset($_SERVER['HTTP_REFERER']))
- // header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP);
- //else
- // header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP);
+ if($query->rowCount() < 1)
+ error(ERROR_INVALIDPOST);
+
+ while($post = $query->fetch()) {
+ deletePost($post['id'], false);
+ }
+
+ if(isset($_SERVER['HTTP_REFERER']))
+ header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP);
+ else
+ header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP);
} elseif(preg_match('/^\/ban$/', $query)) {
// Ban page