Php session Info and cookies


Php session Info and cookies

1Cookiesare small files saved on the user’s computer
2 Cookies can only be readfrom the issuing domain
3 Cookies can have an expiry time, if it is not set, then the cookie expireswhen the browseris closed
4 Sessions are like global variablesstored on the server
5 Each session is given a unique identification idthat is used to track the variables for a user.
6 Both cookies and sessionsmust be started before any HTML tagshave been sentto the browser.

Cookies are great little tools, but they get a bad rap in the press when nasty people misuse them.
These little bits of text will make your development life much easier if you use them properly.
 #Set a cookie
 #Extract data from a cookie 

Sessions are like cookies on steroids.
 Using sessions, you can maintain user-specific information without setting multiple cookies or even using a database.
 Start a session
Add a variable to the $_SESSION superglobal
Enable a per-user access count
Maintain user preferences throughout multiple pages