diff --git a/inc/mod.php b/inc/mod.php index 115c595a..4e82aaeb 100644 --- a/inc/mod.php +++ b/inc/mod.php @@ -34,23 +34,23 @@ } function setCookies() { - global $mod; + global $mod, $config; if(!$mod) error('setCookies() was called for a non-moderator!'); - // MOD_COOKIE contains username:hash - setcookie(MOD_COOKIE, $mod['username'] . ':' . $mod['hash'], time()+COOKIE_EXPIRE, JAIL_COOKIES?ROOT:'/', null, false, true); + // $config['cookies']['mod'] contains username:hash + setcookie($config['cookies']['mod'], $mod['username'] . ':' . $mod['hash'], time()+$config['cookies']['expire'], $config['cookies']['jail']?$config['root']:'/', null, false, true); // Put $mod in the session $_SESSION['mod'] = $mod; // Lock sessions to IP addresses - if(MOD_LOCK_IP) + if($mod['lock_ip']) $_SESSION['mod']['ip'] = $_SERVER['REMOTE_ADDR']; } function destroyCookies() { // Delete the cookies - setcookie(MOD_COOKIE, 'deleted', time()-COOKIE_EXPIRE, JAIL_COOKIES?ROOT:'/', null, false, true); + setcookie($config['cookies']['mod'], 'deleted', time()-$config['cookies']['expire'], $config['cookies']['jail']?$config['root']:'/', null, false, true); // Unset the session unset($_SESSION['mod']); @@ -71,7 +71,7 @@ $cookie = explode(':', $_COOKIE['mod']); if(count($cookie) != 2) { destroyCookies(); - error(ERROR_MALFORMED); + error($config['error']['malformed']); } // Validate session @@ -79,7 +79,7 @@ $cookie[1] != $_SESSION['mod']['hash']) { // Malformed cookies destroyCookies(); - error(ERROR_MALFORMED); + error($config['error']['malformed']); } // Open connection @@ -88,7 +88,7 @@ // Check username/password if(!login($_SESSION['mod']['username'], $_SESSION['mod']['password'], false)) { destroyCookies(); - error(ERROR_INVALIDAFTER); + error($config['error']['invalidafter']); } } @@ -96,7 +96,7 @@ // Generates a