I am slightly confused with this words. As I am working on php dev. i know use of Get and post method but finding difficult to understand the accurate meaning of Session , Cookies and request on php Dev.
Any One Please can you explain this words .... Thanks in Advance ....
Session , Cookies , Request .........
Moderator: General Moderators
-
sagarpparakh
- Forum Newbie
- Posts: 4
- Joined: Fri Jan 01, 2010 11:00 pm
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Session , Cookies , Request .........
SESSION persist for the duration of the application, once your browser closes (tyypically this can be changed) your session variables are destroyed. They are specific to individual user.
COOKIE persist similar to SESSION (again can be changed) but are stored on the client side as opposed to the server side, like SESSION. Cookies are limited in the amount of data they can persist, so most developers prefer session storage as the limit is far greater.
You would typically use both to store items for a shopping cart, etc which are saved until the user closes browser, checkout, etc.
COOKIE persist similar to SESSION (again can be changed) but are stored on the client side as opposed to the server side, like SESSION. Cookies are limited in the amount of data they can persist, so most developers prefer session storage as the limit is far greater.
You would typically use both to store items for a shopping cart, etc which are saved until the user closes browser, checkout, etc.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Session , Cookies , Request .........
And request is just a super-global variable ($_SESSION) that has the contents of $_POST, $_GET, and, I think, $_COOKIE.
-
sagarpparakh
- Forum Newbie
- Posts: 4
- Joined: Fri Jan 01, 2010 11:00 pm
Re: Session , Cookies , Request .........
Thanks .....
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: Session , Cookies , Request .........
What Jonah said about $_REQUEST, and never use it! It does contain $_GET, $_POST, and $_COOKIE data, in some order. If $_GET, $_POST, or $_COOKIE contain the same-named variable, one will take precedence, and the other will be overwritten.