Jump to content

Recommended Posts

In the case of a session, the cookie only holds an identification number, and when the user who has the cookie accesses the pages that are in the session, their browser identifies itself to the server as holding the session cookie. When the server then sends the page to the user, it uses data that was stored in the $_SESSION array. The beauty of using sessions is that an array value may be stored, and even if the back button is pressed on the browser, the array value is still the same. For this reason a shopping cart is usually set up with a session. The cart itself normally contains items, and when items are added or deleted from the cart, the $_SESSION array is updated. If a user then hits the back button, or browses the site and comes back, the shopping cart is still "alive" and holds the items that are still supposed to be there. I hope this makes sense. There are other reasons for using sessions, and perhaps others might add some knowledge here.

A lot of places use cookies to identify if a person has voted in a poll.  example after a person voted you put a cookie on there computer saying that they voted, this way instead of showing the voting option you show the results...  You may also just want some data that you don't need to keep perminitly but just helps to make your site look better and instead of storing it in a database, you give them a cookie if they delete it doesn't matter, just like things such as user last visited this post at 12:oo pm, there was a new post at 3:00pm so put a little image saying new post next to the link, if there was no new post after 12:00pm no action.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.