getMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sMessage, ""); if ($sMessage <> "") { // Message in Session, display if (!$hidden) $sMessage = "" . $sMessage; $html .= "
" . $sMessage . "
"; $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session } // Warning message $sWarningMessage = $this->getWarningMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sWarningMessage, "warning"); if ($sWarningMessage <> "") { // Message in Session, display if (!$hidden) $sWarningMessage = "" . $sWarningMessage; $html .= "
" . $sWarningMessage . "
"; $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session } // Success message $sSuccessMessage = $this->getSuccessMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sSuccessMessage, "success"); if ($sSuccessMessage <> "") { // Message in Session, display if (!$hidden) $sSuccessMessage = "" . $sSuccessMessage; $html .= "
" . $sSuccessMessage . "
"; $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session } // Failure message $sErrorMessage = $this->getFailureMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sErrorMessage, "failure"); if ($sErrorMessage <> "") { // Message in Session, display if (!$hidden) $sErrorMessage = "" . $sErrorMessage; $html .= "
" . $sErrorMessage . "
"; $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session } echo "
" . $html . "
"; } var $Token = ""; var $TokenTimeout = 0; var $CheckToken = EW_CHECK_TOKEN; var $CheckTokenFn = "ew_CheckToken"; var $CreateTokenFn = "ew_CreateToken"; // Valid Post function ValidPost() { if (!$this->CheckToken || !ew_IsHttpPost()) return TRUE; if (!isset($_POST[EW_TOKEN_NAME])) return FALSE; $fn = $this->CheckTokenFn; if (is_callable($fn)) return $fn($_POST[EW_TOKEN_NAME], $this->TokenTimeout); return FALSE; } // Create Token function CreateToken() { global $gsToken; if ($this->CheckToken) { $fn = $this->CreateTokenFn; if ($this->Token == "" && is_callable($fn)) // Create token $this->Token = $fn(); $gsToken = $this->Token; // Save to global variable } } // // Page class constructor // function __construct() { global $conn, $Language; global $UserTable, $UserTableConn; $GLOBALS["Page"] = &$this; $this->TokenTimeout = ew_SessionTimeoutTime(); // Language object if (!isset($Language)) $Language = new cLanguage(); if (!isset($GLOBALS["users"])) $GLOBALS["users"] = new cusers(); // Page ID if (!defined("EW_PAGE_ID")) define("EW_PAGE_ID", 'logout', TRUE); // Start timer if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer(); // Open connection if (!isset($conn)) $conn = ew_Connect(); // User table object (users) if (!isset($UserTable)) { $UserTable = new cusers(); $UserTableConn = Conn($UserTable->DBID); } } // // Page_Init // function Page_Init() { global $gsExport, $gsCustomExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm; // Security $Security = new cAdvancedSecurity(); // Global Page Loading event (in userfn*.php) Page_Loading(); // Page Load event $this->Page_Load(); // Check token if (!$this->ValidPost()) { echo $Language->Phrase("InvalidPostRequest"); $this->Page_Terminate(); exit(); } // Create Token $this->CreateToken(); } // // Page_Terminate // function Page_Terminate($url = "") { global $gsExportFile, $gTmpImages; // Page Unload event $this->Page_Unload(); // Global Page Unloaded event (in userfn*.php) Page_Unloaded(); // Export $this->Page_Redirecting($url); // Close connection ew_CloseConn(); // Go to URL if specified if ($url <> "") { if (!EW_DEBUG_ENABLED && ob_get_length()) ob_end_clean(); header("Location: " . $url); } exit(); } // // Page main // function Page_Main() { global $Security, $Language, $UserProfile; $bValidate = TRUE; $sUsername = $Security->CurrentUserName(); // Call User LoggingOut event $bValidate = $this->User_LoggingOut($sUsername); if (!$bValidate) { $sLastUrl = $Security->LastUrl(); if ($sLastUrl == "") $sLastUrl = "index.php"; $this->Page_Terminate($sLastUrl); // Go to last accessed URL } else { if (@$_COOKIE[EW_PROJECT_NAME]['AutoLogin'] == "") // Not autologin setcookie(EW_PROJECT_NAME . '[Username]', ""); // Clear user name cookie setcookie(EW_PROJECT_NAME . '[Password]', ""); // Clear password cookie setcookie(EW_PROJECT_NAME . '[LastUrl]', ""); // Clear last URL // Call User LoggedOut event $this->User_LoggedOut($sUsername); // Clean upload temp folder ew_CleanUploadTempPaths(session_id()); // Unset all of the Session variables $_SESSION = array(); // Delete the Session cookie and kill the Session if (isset($_COOKIE[session_name()])) setcookie(session_name(), '', time()-42000, '/'); // Finally, destroy the Session @session_destroy(); // If session expired, show expired message if (@$_GET["expired"] == "1") $this->Page_Terminate("login.php?expired=1"); // Go to login page else $this->Page_Terminate("login.php"); // Go to login page } } // Page Load event function Page_Load() { //echo "Page Load"; } // Page Unload event function Page_Unload() { //echo "Page Unload"; } // Page Redirecting event function Page_Redirecting(&$url) { // Example: //$url = "your URL"; } // Message Showing event // $type = ''|'success'|'failure' function Message_Showing(&$msg, $type) { // Example: //if ($type == 'success') $msg = "your success message"; } // User Logging Out event function User_LoggingOut($usr) { // Enter your code here // To cancel, set return value to FALSE; return TRUE; } // User Logged Out event function User_LoggedOut($usr) { //echo "User Logged Out"; } } ?> Page_Init(); // Page main $logout->Page_Main(); ?> Page_Terminate(); ?>