Cookie name problem?

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
kalpesh
Forum Commoner
Posts: 54
Joined: Sun Sep 21, 2008 5:04 am

Cookie name problem?

Post by kalpesh »

Hi, I see most of sites storing their cookie in browser having file name like this.
Cookie:administrator@example.com/

but When i try to do like that cookie is not created.
But it works when i do this.
setcookie ("Example", $value,time()+3600,"/example.com");
But it does not work like this:
setcookie ("Example", $value,time()+3600,"Cookie:administartor@example.com/");

I try to create cookie like all other sites do.
Please Help me.
Thanks in advance.
SteveC
Forum Commoner
Posts: 44
Joined: Thu Dec 04, 2008 2:39 pm
Location: Lansing, MI

Re: Cookie name problem?

Post by SteveC »

kalpesh wrote:Hi, I see most of sites storing their cookie in browser having file name like this.
Cookie:administrator@example.com/

but When i try to do like that cookie is not created.
But it works when i do this.
setcookie ("Example", $value,time()+3600,"/example.com");
But it does not work like this:
setcookie ("Example", $value,time()+3600,"Cookie:administartor@example.com/");

I try to create cookie like all other sites do.
Please Help me.
Thanks in advance.

Code: Select all

setcookie ("Example", $value,time()+3600,"/",".example.com");

That's the correct way. The cookie you're seeing stored is how it is being represented by the browser, not how the websites are storing it.
Post Reply