|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
destroy and set new cookie
I am trying to create a page where once i pressed a link, he will be directed to a page where previous cookies/session in the machine will be destroyed..
but i encounter prob in destroying the cookie/session... my code to create cookie: function GetCartId() { //generate an encrypted string and set it as cookie if (isset($_COOKIE["cartId"])) { return $_COOKIE["cartId"]; } else { session_start(); setcookie("cartId", session_Id(), time() + ((3600 * 24) * 2)); return session_id(); } } ...> how can i use php code in other page to destroy this cookie and then redirect back to the main page to craete a new cookie ??? i tried to use time-60 to destroy the cookie and then use header back to the previous page to create new cookie.. but it is not working.. my code: <? setcookie("cartId","", time() - 60); header ("location:activate.php"); ?> please advise. |
|
#2
|
|||
|
|||
|
PHP Code:
__________________
-- Jason |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > destroy and set new cookie |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|