not able to unset cookie on https page
Posted: Sat Sep 18, 2010 4:14 am
Hi All
I've been trying this over a week and its driving me crazy. I have a login page on https and rest of the website on normal http. I set the cookie of username and password on the login page.
and then on index.php page, I unset it when user clicks on logout button.
THE PROBLEM IS that after I click on logout it is able to unset it on all the http pagesbut when I go on the login page, this cookie is set there and shows me the value. I'm NOT able to unset it on the login page ( i guess because thats a https) . please advice. i'm tried everything but its not working.
Thanks in advance.
I've been trying this over a week and its driving me crazy. I have a login page on https and rest of the website on normal http. I set the cookie of username and password on the login page.
Code: Select all
setcookie("Remember_Cookies[username]", $txtusername, $time + 2592000); // Sets the cookie username for one month
setcookie("Remember_Cookies[password]", $txtpassword, $time + 2592000); // Sets the cookie password for one monthCode: Select all
if(!empty($logout))
{
$_SESSION['USER'] = "";
$_SESSION = "";
@session_destroy();
if(isset($_COOKIE['Remember_Cookies'])) // If the cookie 'Remember_Cookies is set, do the following;
{
$time = time();
setcookie("Remember_Cookies[username]",'', $time - 2592000);
setcookie("Remember_Cookies[password]",'', $time - 2592000);
}Thanks in advance.