summaryrefslogtreecommitdiff
path: root/inc/mod.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-02-11 23:02:30 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-02-11 23:02:30 +1100
commitc34ea2e3af01d9a688fb14b3da550aa96615f312 (patch)
tree8560552c1f92ce13452cca79172799491ff9b69a /inc/mod.php
parent0346862645aa0b9a8ba0f0d929b336b08ff8fcf4 (diff)
a Fixed delete by IP, plus a bunch of small stuff
Diffstat (limited to 'inc/mod.php')
-rw-r--r--inc/mod.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/inc/mod.php b/inc/mod.php
index 5a3e6157..115c595a 100644
--- a/inc/mod.php
+++ b/inc/mod.php
@@ -20,7 +20,7 @@
$query = prepare("SELECT `id`,`type` FROM `mods` WHERE `username` = :username AND `password` = :password LIMIT 1");
$query->bindValue(':username', $username);
$query->bindValue(':password', $password);
- $query->execute();
+ $query->execute() or error(db_error($query));
if($user = $query->fetch()) {
return $mod = Array(
@@ -56,6 +56,16 @@
unset($_SESSION['mod']);
}
+ function modLog($action) {
+ global $mod;
+ $query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :time, :text)");
+ $query->bindValue(':id', $mod['id'], PDO::PARAM_INT);
+ $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
+ $query->bindValue(':time', time(), PDO::PARAM_INT);
+ $query->bindValue(':text', $action);
+ $query->execute() or error(db_error($query));
+ }
+
if(isset($_COOKIE['mod']) && isset($_SESSION['mod']) && is_array($_SESSION['mod'])) {
// Should be username:session hash
$cookie = explode(':', $_COOKIE['mod']);