Log out clearing cart
Hi Jason,
Thanks for your help and your patience. I am getting closer. It is now clearing the cart properly which is great and it leaves or keeps the login session going but somehow i need to pick up the password. If we simply user the username it is picking up the first "Ron" in the list and logging in as them. It doesn't seem to catch the other two session variables.
<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();
//store the user session
$userSession = $_SESSION['MM_Username'];
$userSession = $_SESSION['pass_word'];
$userSession = $_SESSION['user_name'];
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
@setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Finally, destroy the session.
session_destroy();
unset($_SESSION);
session_start();
session_regenerate_id();
//reset user session
$_SESSION['MM_Username'] = $userSession;
$_SESSION['pass_word'] = $userSession;
$_SESSION['user_name'] = $userSession;
?>
Per you code here are the session variables when I initially log in ...
<pre>array(4) {
["MM_Username"]=>
string(3) "ron"
["MM_UserGroup"]=>
string(0) ""
["pass_word"]=>
string(8) "changed"
["user_name"]=>
string(3) "ron"
}
</pre>
This is what happens when I order something on the cart and checkout ...
<pre>array(4) {
["MM_Username"]=>
string(3) "ron"
["MM_UserGroup"]=>
string(3) "ron"
["pass_word"]=>
string(3) "ron"
["user_name"]=>
string(3) "ron"
}
</pre>
all the sessions switch to username Ron. I am not storing the sessions properly?
Any suggestions?