diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-23 22:24:48 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-23 22:24:48 +1100 |
| commit | 95ffef8876cbfd0dc4f46fd2d83060990434e7df (patch) | |
| tree | a601d73a933f8c03315b9bb676b0d8251daf7b6b | |
| parent | d1c2db4493c2b9ecfd597d3f8a8155aba25cee05 (diff) | |
Use LIKE instead of REGEX for wildcard bans
| -rw-r--r-- | inc/functions.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php index 5d59c300..a40e55eb 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -484,7 +484,7 @@ $query->bindValue(':board', $board); $query->execute() or error(db_error($query)); if($query->rowCount() < 1 && $config['ban_range']) { - $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `uri`, `bans`.`id` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` WHERE (`board` IS NULL OR `uri` = :board) AND :ip REGEXP CONCAT('^', REPLACE(REPLACE(`ip`, '.', '\\.'), '*', '.*'), '$') ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1"); + $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `uri`, `bans`.`id` FROM `bans` LEFT JOIN `boards` ON `boards`.`id` = `board` WHERE (`board` IS NULL OR `uri` = :board) AND :ip LIKE REPLACE(REPLACE(`ip`, '%', '!%'), '*', '%') ESCAPE '!' ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1"); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->bindValue(':board', $board); $query->execute() or error(db_error($query)); |
