Jump to content

[Solved] The problem about logout


Recommended Posts

Now, my site cannot logout

When we login and try to logout

it will redirect to "index.php?mylogout" and there is nothing show on the screen.

I try to change in init.php

if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned(intval($cookie->id_customer))))
{
$cookie->logout();
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}
elseif (isset($_GET['mylogout']))
{
$cookie->mylogout();

//Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
Tools::redirect('index.php'); <==== Change at here!!!!!!!!!!!!!!
}


But, there still not work

After clieck Logout, it still stay at the "index.php?mylogout" and there is nothing show on the screen.

Please give me some suggection

Link to comment
Share on other sites

PS version : 1.1
Theme (default/custo) : Modify from defualt theme
Code (original/modified) : Modify
Browsers used : IE 7 && Firefox 1.5


At last week, the logout process was worked. But, after I modify something more on my website ==> now it cannot logout.

You can try at
www.sawadeekorea.net/prestashop/ (it's only THAI language, but you can try the login-logout process)


Thx in advance

Link to comment
Share on other sites

After i try to debug the code:

The code wad die in the init.php at here:

if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned(intval($cookie->id_customer))))
{  
   $cookie->logout();
   Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}
elseif (isset($_GET['mylogout']))
{

   echo "check01";
    $cookie->mylogout();
   Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
   echo "check02"; <=== The code is stopped here and doesnot execute this line
}




And after i go to Tools.php it look like the "exit" is doesn't work:


    static public function redirect($url, $baseUri = __PS_BASE_URI__)

   {

       echo "TOOL>Redirect";    <== It can show this line
       if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER'])) {
           header('Location: '.$_SERVER['HTTP_REFERER']);
           echo "C1";   <== It can show this line
       } else {
           header('Location: '.$baseUri.$url);
           echo "C2";
       }
       echo "BeforeExit";  <== It can show this line
       exit;    <== It seem that the "Exit" it doesnot work !!! So it cannot return to Init.php page

   }




How to fixed??

Link to comment
Share on other sites

  • 1 year later...

Hi, I faced the same problem from long. Now i got the solution for it. First you have to remove the custom module added from control panel.
second in init.php use "SCRIPT_URI" instead of "HTTP_REFERER".

These two modification resolved my logout issue. I hope same will work for you.

Link to comment
Share on other sites

  • 11 months later...
  • 1 month later...
×
×
  • Create New...