July 16th, 2000, 08:36 AM
-
First I set a cookie, then whenever someone visits the site I check the MySQL DB to see if they have a cookie, if they do then it updates the users row in the DB.
But...I set a cookie and when they come back they get another cookie eg:
cookie:anyuser@musicgoeson.com
and then they get another cookie:
cookie:somethingelse@musicgoeson.com
why?
Girish Gupta
webmaster@musicgoeson.com
[This message has been edited by girish_gupta (edited July 16, 2000).]
July 16th, 2000, 10:55 AM
-
Girish ,
how you are setting?..if you post that code portion then we can help you out what is gone wrong..
cookie eg:
setcookie("cookiename","cookie value",time()+14400,"/","www.yourdomain.com");
------------------
SR -
webshiju.com
"The fear of the LORD is the beginning of knowledge..."
July 16th, 2000, 02:19 PM
-
Here's the code I use:
$result = mysql_query ("SELECT * FROM cookie WHERE userid = '$CookieID'");
if ($row = mysql_fetch_array($result))
{
mysql_query ("UPDATE cookie set last_visit = '$date | $time GMT', user_agent = '$HTTP_USER_AGENT', remote_host = '$REMOTE_HOST', remote_addr = '$REMOTE_ADDR' WHERE userid = '$CookieID';");
}
else
{
mysql_query ("INSERT INTO cookie (name, email, last_visit, user_agent, referrer, remote_host, remote_addr) VALUES ('$name', '$email', '$date | $time GMT', '$HTTP_USER_AGENT', '$HTTP_REFERER', '$REMOTE_HOST', '$REMOTE_ADDR')");
setcookie("CookieID", mysql_insert_id(), time()+94608000, "/");
}
Girish Gupta
webmaster@musicgoeson.com
July 16th, 2000, 11:49 PM
-
<<
setcookie("CookieID", mysql_insert_id(), time()+94608000, "/");
>>
girish ,
You are not using the 5th argument(ie,'www.yourdomain.com'),that is why your cookie won't available through out your site..
setcookie("CookieID", mysql_insert_id(), time()+94608000, "/","www.musicgoeson.com");
other things seems fine i suppose..
------------------
SR -
webshiju.com
"The fear of the LORD is the beginning of knowledge..."