cookie problem!
Posted: Mon Feb 28, 2005 12:43 am
im trying to assign a cookie with a diffrent value for every user so the cookie has your user ID. heres my code
but it dosn't work properly, when i close my browser and open it back up to destroy the session the cookie is no longer set. with this at the top of the script i would always have a cookie am i correct? but i tried adding in this right after those lines of code
but when i destroyed the session it would give me the die error, but i didnt delete the cookies? plus wouldnt the cookie already be set anyway if it did not exist by the lines directly before this? im confused
Code: Select all
$sessID = session_id();
if (!isset($_COOKIEї'cartID'])){
setcookie('cartID', $sessID, time()+60*60*24*30, '/', '', 0);
}
$cartID = $_COOKIEї'cartID'];Code: Select all
if (!isset($_COOKIEї'cartID'])){
die('You Must Have Cookies Enabled');
}