Results 1 to 3 of 3
Thread: PHP & Cookies
May 16, 2000, 18:48 #1
May 16, 2000, 19:03 #2RAGESitePoint Community Guest
May 16, 2000, 19:06 #3
- Join Date
- Aug 1999
- Lancaster, Ca. USA
- 1 Post(s)
- 0 Thread(s)
They are added in the response headers of the webpage. ASP works the same way.
When you type in an address or click on an URL to go to a page the browser sends a heck of a lot of info to the server. This includes IP address, Referring URL, any cookies you might have for that site, posted form responses and so forth. This is all behind the scenes. These are the request headers.
When the server starts to send the webpage back it includes its own group of headers these can include cookies. These are the response headers.
When the browser recieves cookies in the response headers it will write them to the hard drive, overwriting what does exist as long as it doesn't overflow the 4K barrier. Not only ASP and PHP can do this but any server side process can add cookies to the Response headers if programmed properly.
I don't know how PHP works but in ASP there is a Response object and it has a cookies collection that can be added to as needed. When you want to read cookies from the user then you would use the Request object's corresponding cookie collection. I am sure PHP has similar objects and collections.
Wayne Luke - Sitepoint Moderator/Internet Media Developer
Digital Magician Studios - Making Magic with Web Applications