Chapter 9: Session Management with Tied Hashes

Overview

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.



Perl Database Programming
Perl Database Programming
ISBN: 0764549561
EAN: 2147483647
Year: 2001
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net