1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-12 10:00:49 +01:00

Bug fix: users were banned from /0/ if they had a ban anywhere else

Conflicts:
	inc/bans.php
This commit is contained in:
Fredrick Brennan 2014-09-20 15:20:00 +00:00
parent ea3c571d6c
commit 9070b061ee

View File

@ -122,13 +122,13 @@ class Bans {
$query = prepare('SELECT ``bans``.*' . ($get_mod_info ? ', `username`' : '') . ' FROM ``bans`` $query = prepare('SELECT ``bans``.*' . ($get_mod_info ? ', `username`' : '') . ' FROM ``bans``
' . ($get_mod_info ? 'LEFT JOIN ``mods`` ON ``mods``.`id` = `creator`' : '') . ' ' . ($get_mod_info ? 'LEFT JOIN ``mods`` ON ``mods``.`id` = `creator`' : '') . '
WHERE WHERE ' . ($id ? 'id = :id' : '
(' . ($board ? '(`board` IS NULL OR `board` = :board) AND' : '') . ' (' . ($board !== false ? '(`board` IS NULL OR `board` = :board) AND' : '') . '
(`ipstart` = :ip OR (:ip >= `ipstart` AND :ip <= `ipend`))) (`ipstart` = :ip OR (:ip >= `ipstart` AND :ip <= `ipend`)))') . '
ORDER BY `expires` IS NULL, `expires` DESC'); ORDER BY `expires` IS NULL, `expires` DESC');
if ($board) if ($board !== false)
$query->bindValue(':board', $board); $query->bindValue(':board', $board, PDO::PARAM_STR);
$query->bindValue(':ip', inet_pton($ip)); $query->bindValue(':ip', inet_pton($ip));
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));