I’m creating a dynamic website with php & mysql. I’ve 2 folders, one is user and other is admin. In user folder i put user_logout.php page and in admin folder i put admin_logout.php. So that the issue is when i sign out from user panel it’s successfully sign out from user panel BUT in the same time it’s also sign out from Admin panel if i sign in.
User_logout.php page
<?php
include("db.php");
include("include/session.php");
$tm=date("Y-m-d H:i:s");
$q=mysql_query("UPDATE plus_user_login SET status='OFF', tm_out='$tm' WHERE
id='$_SESSION[id]'");
echo mysql_error();
$see = $_SESSION['uname'];
session_unset($see);
session_destroy();
echo "<h1><center>You have been successfully Log Out</h1></center><br/>";
?>
Admin_logout.php page
<?php
include("include/session.php");
include("db.php");
$q=mysql_query("update plus_login set status='OFF' where id='$_SESSION[id]'");
session_unset($_SESSION['uname_ad']);
session_destroy();
echo "<br/>";
echo "<h1>You have been successfully Log Out</h1><br/>";
?>
Any help about this issue?
Thanks a lot.
removing that code should solve your problem.
Although also make sure that you are not mixing up the session indexes while logging in.
EDIT:
What is $_SESSION[‘id’] doing in the code? I don’t see how it is related to $_SESSION[‘uname’] and $_SESSION[‘uname_ad’]?
If you are retrieving the status from database, try changing $_SESSION[‘id’] with $_SESSION[‘uname’] and $_SESSION[‘uname_ad’] in corresponding update query.
Also tell, how you check the login status. Against the database or only on basis of session data?