FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


global cookie!





Peterssidan
I have a problem with cookies in php. I want to set a cookie in http://www.dataapa.frih.net/kabe/ but I want to reach it from every where. http://www.dataapa.frih.net/ and I want to be abel to set cookies here and they should be reachable from "kabe".
I have tried but it will not work.
Quote:

setcookie("lang", $_SESSION["lang"], time()+3600, "/", $_SERVER['HTTP_HOST']);

What is wrong?
jabapyth
if you set the directory as '/', it should work. check the cookie's directory (using your browser)
jabapyth
also, be sure that you havnt output anything yet, otherwise the cookie wont be set [see http://us2.php.net/setcookie ]
Peterssidan
Thanks! I found that it was my foult. Embarassed
I tested with print out the cookie but I copy and paste it so it wasn't the cookie I tried to print, it was the session with the same name. anyway...
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.