Problem with Cookies

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Problem with Cookies

Post by aetoc »

I set the setcookie("lightbox", "bret", time()+604800, "/", "skata"); in index.php but it dosn't work.

I't dosn't do enything.

Someone HEEEEEEEEELP me please.
Ward
Forum Commoner
Posts: 74
Joined: Thu Jul 13, 2006 10:01 am

Post by Ward »

Try removing the domain, and see if that helps. Also, are you calling setcookie() before *any* output has been sent to the browser?

Code: Select all

setcookie("lightbox", "bret", time()+604800, "/")
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Post by aetoc »

Thanks man. It works.

Now I have an other problem.

The cookie that has bean created is caled server_user@192.168.100.txt (local server)

How can I read the data?

Thanks man.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

$_COOKIE['lightbox'];
aetoc
Forum Commoner
Posts: 37
Joined: Tue Jan 31, 2006 2:48 am

Post by aetoc »

Thanks both of you.

You get me out of BIG truble
Post Reply