forked from leftypol/leftypol
Remove expired IP range bans properly
This commit is contained in:
parent
b4aa39ca2d
commit
5b841d1e53
1 changed files with 7 additions and 0 deletions
|
@ -211,6 +211,13 @@
|
||||||
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
|
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
|
||||||
$query->bindValue(':expires', $ban['expires'], PDO::PARAM_INT);
|
$query->bindValue(':expires', $ban['expires'], PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
$body = '<div class="ban">
|
$body = '<div class="ban">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue