Delete by IP

This commit is contained in:
Savetheinternet 2011-02-05 15:43:42 +11:00
parent 5b8ace603e
commit a3d22a79b7

19
mod.php
View File

@ -357,14 +357,21 @@
if(!openBoard($boardName)) if(!openBoard($boardName))
error(ERROR_NOBOARD); error(ERROR_NOBOARD);
$query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = :ip", $board['uri'])); $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `ip` = (SELECT `ip` FROM `posts_%s` WHERE `id` = :id)", $board['uri'], $board['uri']));
$query->bindValue(':ip', $ip); $query->bindValue(':id', $post);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
//if(isset($_SERVER['HTTP_REFERER'])) if($query->rowCount() < 1)
// header('Location: ' . $_SERVER['HTTP_REFERER'], true, REDIRECT_HTTP); error(ERROR_INVALIDPOST);
//else
// header('Location: ?/' . sprintf(BOARD_PATH, $boardName) . FILE_INDEX, true, REDIRECT_HTTP); 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)) { } elseif(preg_match('/^\/ban$/', $query)) {
// Ban page // Ban page