forked from GithubBackups/tinyib
Fix fetching last post by IP address on some database modes
Resolves #138.
This commit is contained in:
parent
573282f53b
commit
12d9fdf612
@ -139,7 +139,7 @@ function trimThreads() {
|
||||
|
||||
function lastPostByIP() {
|
||||
global $link;
|
||||
$replies = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']) . "' OR `ip` = '" . mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']) . "' ORDER BY `id` DESC LIMIT 1");
|
||||
$replies = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `ip` = '" . mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']) . "' OR `ip` = '" . mysqli_real_escape_string($link, hashData($_SERVER['REMOTE_ADDR'])) . "' ORDER BY `id` DESC LIMIT 1");
|
||||
if ($replies) {
|
||||
while ($post = mysqli_fetch_assoc($replies)) {
|
||||
return $post;
|
||||
|
@ -128,7 +128,7 @@ function trimThreads() {
|
||||
}
|
||||
|
||||
function lastPostByIP() {
|
||||
$result = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE ip = ? ORDER BY id DESC LIMIT 1", array($_SERVER['REMOTE_ADDR']));
|
||||
$result = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE ip = ? OR ip = ? ORDER BY id DESC LIMIT 1", array($_SERVER['REMOTE_ADDR'], hashData($_SERVER['REMOTE_ADDR'])));
|
||||
return $result->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user