PHP and Cookies; a good mix!
(Page 1 out of 5)Cookies have long been used in PHP scripts, and are a very useful function. But what exactly are cookies? Maybe you have used then, but you still don't know exactly what they are. Or you are completely new to cookies? It doesn't matter, because in this tutorial I will show you exactly what cookies are, and what they are used for.
Cookies in a nutshell
Cookies are small pieces of information that is stored on the computer of your visitors. Each browser handles it differently, but most simply store the information in a small text file. Internet Explorer has a special folder, which can be found in your C:\Windows or C:\Windows\System32 folder. You can delete all your cookies, by going to the Options and 'Clearing Cookies' or deleting them by hand. I don't recommend this though.
Almost every website uses cookies. If you go to Amazon.com, you will get several cookies. The same goes for CNN.com. Even Google uses cookies! They are extremely useful for (temporarily) storing information. For example, if you have a login system for your visitors, you could save their userid and password (very heavily encrypted!) so they are automatically logged in the next time they visit your website.
Or you could remember their last visit, and highlight everything that is new. And that's just the beginning.
February 16th, 2006 at 3:09 pm
This site is very helpful to me.
I expect more examples about session and cookies from this site.
Thanks a lot.