Page 3 of 3

Posted: Sun Aug 06, 2006 9:02 pm
by Ambush Commander
Replace time() - 3600 with 0. Also remember that the $_COOKIES array doesn't get cleared until next request.

Posted: Mon Aug 07, 2006 11:27 am
by LuiePL
I threw this code into the top of my "Logout.php" page, and it works in IE6 but not Firefox:

Code: Select all

$expiry = 1;
setcookie('user', '', $expiry);
header('Location: index.php');

Posted: Mon Aug 07, 2006 2:54 pm
by RobertGonzalez
Clear your cache in FF. Also, use a full URL instead of a relative when using the header() function, as per the manual.

Posted: Mon Aug 07, 2006 4:43 pm
by LuiePL
I tried clearing the cache, deleting the original cookie, and using the full http://www.mydomain.org/Directory/index.php and still no luck. It's still working in IE though.

Posted: Wed Aug 09, 2006 1:09 am
by LuiePL
Set it to the following, and moved it over to a subdomain and now it's working like a charm.

Code: Select all

if (isset($_COOKIE['user']))
	{
		$cookie_info = explode("-", $_COOKIE['user']);
		$name = $cookie_info[0];
		$pass = $cookie_info[1];
		$cookie_data = $name.'-'.$pass;
		$expiry = 1;
		$directory = "";
		$domain = "subdomain.mydomain.org";
	
		setcookie ("user", $cookie_data, $expiry, $directory, $domain, "0");
		header('Location: http://subdomain.mydomain.org/index.php');
	}

Posted: Wed Aug 09, 2006 1:26 am
by RobertGonzalez
When you set the domain in the first script, was it 'domain.com' or '.domain.com'?

Posted: Wed Aug 09, 2006 11:47 am
by LuiePL
".domain.org"