Cookie in PHP

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
anp24
Forum Newbie
Posts: 13
Joined: Wed Jul 11, 2007 6:34 am

Cookie in PHP

Post by anp24 »

Hello,
If I create a Cookie in PHP with its path set to '/' (forward slash), then where it is stored . It is stored on client machine or in the Web server where all the web pages are stored?. Is the client machine user can access and change the cookie value.

Thanks
Regards
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Cookie in PHP

Post by social_experiment »

The cookie is stored on the client's computer; From the php manual: (related to the path argument accepted by setcookie())
The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain . If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.
If you want to know if the cookie information can be modified, then yes it can.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
anp24
Forum Newbie
Posts: 13
Joined: Wed Jul 11, 2007 6:34 am

Re: Cookie in PHP

Post by anp24 »

Hello,
Can I create the cookie in PHP which is stored on the web server and not on the client computer

Thank You
Regards
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Cookie in PHP

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply