summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-01-02 02:05:30 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-01-02 02:05:30 +1100
commited693335804765c4784a7cf24c718a43e5fb69bc (patch)
tree084505d3a93837b47b27c9ba36171dc950d2b7f7
parenta22df7b0391612c03c237ec0eeb573b9f1d88719 (diff)
Block banned clients from accessing the moderation panel
-rw-r--r--mod.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/mod.php b/mod.php
index 57c385b2..35261e3f 100644
--- a/mod.php
+++ b/mod.php
@@ -8,6 +8,12 @@
require 'inc/template.php';
require 'inc/database.php';
require 'inc/user.php';
+
+ sql_open();
+
+ // Check if banned
+ checkBan();
+
require 'inc/mod.php';
// Fix some encoding issues
@@ -23,8 +29,6 @@
empty($_POST['password'])
) loginForm(ERROR_INVALID, $_POST['username']);
- // Open connection
- sql_open();
if(!login($_POST['username'], $_POST['password']))
loginForm(ERROR_INVALID, $_POST['username']);
@@ -315,7 +319,7 @@
if(empty($_POST['ip']))
error(sprintf(ERROR_REQUIRED, 'IP address'));
- $query = prepare("INSERT INTO `bans` VALUES (:ip, :mod, :expires, :reason)");
+ $query = prepare("INSERT INTO `bans` VALUES (:ip, :mod, :set, :expires, :reason)");
// 1yr2hrs30mins
// 1y2h30m
@@ -353,6 +357,8 @@
$query->bindValue(':ip', $_POST['ip'], PDO::PARAM_STR);
$query->bindValue(':mod', $mod['id'], PDO::PARAM_INT);
+ $query->bindValue(':set', time(), PDO::PARAM_INT);
+
if(isset($_POST['reason'])) {
$query->bindValue(':reason', $_POST['reason'], PDO::PARAM_STR);
} else {