Often, you want to keep track of a user as he or she moves through your Web site. A database can be the perfect tool for this job. When you combine the database with HTTP cookies, you have the ideal method of keeping track of individual users.
Many Web sites keep track of who you are and even personalize the content based upon your user preferences. Typically, they do this by using a database to store your preferences and by using cookies to store your unique identity.
Cookies are valuable in tasks such as this. Cookies have had some bad press, mainly due to the insecurities in Internet Explorer. The fact is, however, that cookies are a safe way to store information on a Web browser. Also, to boost security even more, we can store all of the information in a database on the Web-server side. Only the user ID is stored in a cookie on the browser side.
At the lowest level, the HTTP server sees just unrelated requests for pages, without any idea of who's really requesting them. But only by using cookies can we properly support the idea of a ‘session' in HTTP.