]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-logout.php
More time() in SQL queries replace with UNIX_TIMESTAMP()
[mailer.git] / inc / modules / member / what-logout.php
index de2afdfe2bf776c393e4332426befbdbf0f6cc21..d2f8e71bbd83b1eb319b0035e317475d931cae60 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
- elseif (!IS_LOGGED_IN())
-{
-       LOAD_URL(URL."/modules.php?module=index");
+} elseif (!IS_LOGGED_IN()) {
+       LOAD_URL("modules.php?module=index");
 }
 
 // Base URL for redirection (both cases)
@@ -50,24 +47,22 @@ $URL = URL."/modules.php?module=index";
 // NEW: Fixed the Set of Cookies, you mus add right TimeSet, if you changed it in What_login.php! (eg. time()- cookieTime
 
 
-if (@setcookie("userid", "", time() - 3600, COOKIE_PATH) && @setcookie("u_hash", "", time() - 3600, COOKIE_PATH) && @setcookie("lifetime", "0", time() - 3600, COOKIE_PATH))
-{
+if (destroy_user_session()) {
        // Remove theme cookie as well
-       @setcookie("mxchange_theme", "", time() - 3600, COOKIE_PATH);
+       set_session("mxchange_theme", "");
 
        // Logout completed
        $URL .= "&msg=".CODE_LOGOUT_DONE;
 
        // Destroy session here
        @session_destroy();
-}
- else
-{
+} else {
        // Cannot logout! :-(
        $URL .= "&msg=".CODE_LOGOUT_FAILED;
 }
 
-//
+// Load the URL
 LOAD_URL($URL);
+
 //
 ?>