What is a Cookie?
Cookies are small bits of information that can be stored on a client computer. Once a cookie is created, it will expire after a specified time period. All the information stored in a cookie exist until it expires or deleted by the user.
Why do we need Cookies?
Now-a-days most of the websites use cookies to store small amounts of information. Websites can read the values from the cookies and use the information as desired. The browser is capable of keeping track of the websites and their corresponding cookies and is capable of reading the information from relevant cookies. Some common use of cookies include:
User's aesthetic preference for a specific site.
User keys to link them with their personal data - as used by many Shopping Cart Applications.
Allowing a user to remain 'logged on' until he explicitly logs out or the browser window is closed.
How to create a cookie?
Cookies can be set using the 'setcookie' function in PHP. This function takes three arguments - name of the variable, value of the variable and the expiry time period.
No comments:
Post a Comment