示例#1
0
文件: init.php 项目: bk-amahi/esoTalk
        header("Location: upgrade/index.php");
    }
    exit;
}
// Require essential files.
require "functions.php";
require "database.php";
require "classes.php";
require "formatter.php";
// Start a session if one does not already exist.
if (!session_id()) {
    session_name("{$config["cookieName"]}_Session");
    session_start();
    $_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
    if (empty($_SESSION["token"])) {
        regenerateToken();
    }
}
// Prevent session highjacking - check the current IP address against the one that initiated the session.
if ($_SERVER["REMOTE_ADDR"] != $_SESSION["ip"]) {
    session_destroy();
}
// Undo register_globals.
undoRegisterGlobals();
// If magic quotes is on, strip the slashes that it added.
if (get_magic_quotes_gpc()) {
    $_GET = array_map("undoMagicQuotes", $_GET);
    $_POST = array_map("undoMagicQuotes", $_POST);
    $_COOKIE = array_map("undoMagicQuotes", $_COOKIE);
}
// Replace GET values with ones from the request URI. (ex. index.php/test/123 -> ?q1=test&q2=123)
示例#2
0
 function logout()
 {
     global $config;
     // Destroy session data
     unset($_SESSION["user"]);
     regenerateToken();
     // Eat the cookie. OM NOM NOM
     if (isset($_COOKIE[$config["cookieName"]])) {
         setcookie($config["cookieName"], "", -1, "/");
     }
     $this->callHook("logout");
     // Redirect to the home page
     redirect("");
 }