PHP Cookies
Tuesday May 2, 2006
Every time I go to post in my blog, the admin link appears to allow me post a new entry. But how does it know to show that to me, and not to other people who read my blog?
Cookies allow a website to store information about you on your computer. In the case of my blog, it is storing my login details, so when I visit from my computer I am automatically logged in until I manually logout.
Cookies have been used on the net for years. They can store anything from your name and page clicks to your login or shopping cart contents. We can use PHP to set, retrieve, and destroy these cookies. Remember if you plan to use cookies to store sensative information (like the login I mentioned), you should encrypt the data first since cookies can be viewed or removed by anyone using the computer.
Cookies allow a website to store information about you on your computer. In the case of my blog, it is storing my login details, so when I visit from my computer I am automatically logged in until I manually logout.
Cookies have been used on the net for years. They can store anything from your name and page clicks to your login or shopping cart contents. We can use PHP to set, retrieve, and destroy these cookies. Remember if you plan to use cookies to store sensative information (like the login I mentioned), you should encrypt the data first since cookies can be viewed or removed by anyone using the computer.


Be aware that it is problematic to set the cookie to just 10 seconds in the past as you suggest. This is due to the local browser using the local time and the server using the server time… If the client machine is out of date, major problems can arise. I recommend something like
setcookie(’mycookie’,”,time()-12345678)