From 0ba23fcf01e5a8d2956bc5931fc3f99c3ce277ba Mon Sep 17 00:00:00 2001 From: Benjamin Southall Date: Mon, 13 Mar 2017 23:34:15 +0900 Subject: [PATCH] Deleting all posts by IP (D++) doesn't seem to work properly #87 Changing query inside the while loop to query2 in order to delete all posts, not just the first post. --- inc/mod/pages.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 57edbe6a..ab7c240e 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1819,9 +1819,9 @@ function mod_deletebyip($boardName, $post, $global = false) { while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); if ($config['autotagging']){ - $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE id = :id", $post['board'])); - $query->bindValue(':id', $post['id'] ); - $query->execute() or error(db_error($query)); + $query2 = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE id = :id", $post['board'])); + $query2->bindValue(':id', $post['id'] ); + $query2->execute() or error(db_error($query2)); $ip = ""; $time = ""; $filename = ""; @@ -1829,7 +1829,7 @@ function mod_deletebyip($boardName, $post, $global = false) { $subject = ""; $name = ""; $body = ""; - while ($mypost = $query->fetch(PDO::FETCH_ASSOC)) { + while ($mypost = $query2->fetch(PDO::FETCH_ASSOC)) { $time = $mypost["time"]; $ip = $mypost["ip"]; $body = $mypost["body_nomarkup"]; @@ -1850,12 +1850,12 @@ function mod_deletebyip($boardName, $post, $global = false) { $autotag .= $body . "\r\n"; $autotag = escape_markup_modifiers($autotag); markup($autotag); - $query = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)'); - $query->bindValue(':ip', $ip); - $query->bindValue(':mod', $mod['id']); - $query->bindValue(':time', time()); - $query->bindValue(':body', $autotag); - $query->execute() or error(db_error($query)); + $query2 = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)'); + $query2->bindValue(':ip', $ip); + $query2->bindValue(':mod', $mod['id']); + $query2->bindValue(':time', time()); + $query2->bindValue(':body', $autotag); + $query2->execute() or error(db_error($query2)); modLog("Added a note for {$ip}"); } }