summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-01-02 01:43:25 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-01-02 01:43:25 +1100
commitd46c40652cf0710c75d7cc1d929ed9f2aa106411 (patch)
tree6738369fc4178b1f5d5bdceace5ded5145815825
parent3c24ecd412d3b589e4ad5382deec4ffc1656f98f (diff)
Bans expire
-rw-r--r--inc/functions.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 70520334..30effd17 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -77,6 +77,14 @@
$query->execute() or error(db_error($query));
if($ban = $query->fetch()) {
+ if($ban['expires'] && $ban['expires'] < time()) {
+ // Ban expired
+ $query = prepare("DELETE FROM `bans` WHERE `ip` = :ip 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">
<h2>You are banned! ;_;</h2>
<p>You have been banned ' .
@@ -94,7 +102,7 @@
'expires on <strong>' .
formatDate($ban['expires']) .
'</strong>, which is ' . until($ban['expires']) . ' from now'
- : '<em>does not expire</em>' ) .
+ : '<em>will not expire</em>' ) .
'.</p>
<p>Your IP address is <strong>' . $_SERVER['REMOTE_ADDR'] . '</strong>.</p>
</div>';