Doubt related to PHP Cookies

Posted by Richa on Programmers See other posts from Programmers or by Richa
Published on 2011-03-08T06:18:25Z Indexed on 2011/03/08 8:18 UTC
Read the original article Hit count: 242

Filed under:

Hey guys!

I have a doubt, I will appreciate if you can clear it .

COOKIES

What are cookies? When described as entities, which is how cookies are often referenced in conversation, you can be easily misled. Cookies are actually just an extension of the HTTP protocol. Specifically, there are two additional HTTP headers: Set-Cookie and Cookie.The operation of these cookies is best described by the following series of events:

  1. Client sends an HTTP request to server.

  2. Server sends an HTTP response with Set-Cookie: foo=bar to client.

  3. Client sends an HTTP request with Cookie: foo=bar to server.

  4. Server sends an HTTP response to client.

Thus, the typical scenario involves two complete HTTP transactions. In step 2, the server is asking the client to return a particular cookie in future requests. In step 3, if the user’s preferences are set to allow cookies, and if the cookie is valid for this particular request, the browser requests the resource again but includes the cookie.

Now my question is.......

why you cannot determine whether a user’s preferences are set to allow cookies during the first request????

© Programmers or respective owner

Related posts about php