Page 1 of 1

deleting the damn cookies

Posted: Thu Jul 11, 2002 8:39 pm
by cheatboy00
now i'm having more problems with those pesky cookies.... anyway i'm creating a logout page which should be easy but my incompetence amazes me ... anyway i duno whats wrong with this it wont update the online file to n like i want and it wont delete the cookies

Code: Select all

if (isset($idcbaa)){

   $dbh = mysql_connect ("localhost", "dragonsb_xmb1", "password") or die ('I cannot connect to the database.');
      mysql_select_db ("dragonsb_xmb1");
	
   mysql_query("UPDATE users SET online='n' WHERE id='$idcbaa'");
}

setcookie ("idcbaa","",time()-3600,"/","cbaa.vze.com");
setcookie ("logcbaa","",time()-3600,"/","cbaa.vze.com");
arg

Posted: Thu Jul 11, 2002 8:53 pm
by Elfstone
To delete a cooke just use:

Code: Select all

setcookie ("cookiename");

Posted: Thu Jul 11, 2002 10:47 pm
by cheatboy00
it worked thanks

Posted: Fri Jul 12, 2002 3:40 am
by mikeq
You MUST delete a cookie with all of the same parameters as it was created, so if you include domains etc when the cookie was created they must also appear when you want to delete the cookie.