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

Remove expired IP range bans properly

This commit is contained in:
Savetheinternet 2011-03-31 00:15:26 +11:00
parent 8b59f4f70d
commit ee40b9b06c

View File

@ -211,6 +211,13 @@
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':expires', $ban['expires'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
if($config['ban_range']) {
$query = prepare("DELETE FROM `bans` WHERE :ip REGEXP CONCAT('^', REPLACE(REPLACE(`ip`, '.', '\\.'), '*', '[0-9]*'), '$') AND `expires` = :expires LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':expires', $ban['expires'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
}
return;
}
$body = '<div class="ban">