I have a website with a login. The script was working for months now. but since a week We noticed when we opened the website it's already logged in by someone else.
Users Can't Log out too sometimes
This issue became very common now. It's happening all the time. Sometimes users aren't able to login. When they do they sometimes end up in the account of the previously logged in account.
We used php SESSIONS
to implement login.
//Login
//Step 1 Facebook Login
//Step 2 Check db or add to db
//Step 3 below
$_SESSION['logouturl'] = $logouturl;
$_SESSION['loggedin'] = true;
$_SESSION['user_data'] = $user_data;
header("Location: $url");
Here is the logout script:
//logout
session_start();
session_destroy() ;
if(isset($_GET['redirect']) && !empty($_GET['redirect']))
{
$url=$_GET["redirect"];
}
else {
$url="http://www.website.com/";
}
header("location:$url");
I figured out this is some issue with the internal working of php sessions.
UPDATE : Thank you to everyone who helped!!
No, we did not find a solution to the problem. The customer was using a reseller hosting. maybe it's gotta do something with the configuration when one site affects the other one.
We set up a new hosting and installed the same script there. Everything is fine and life's good!