PHP DevCenter

oreilly.comSafari Books Online.Conferences.

We've expanded our LAMP news coverage and improved our search! Search for all things LAMP across O'Reilly!

Search
Search Tips

advertisement

Listen Print Subscribe to PHP Subscribe to Newsletters

Session Tracking: Part 2
Pages: 1, 2, 3

Once I've defined these functions, I can then include the library within another script and call the session_set_save_handler() function, which acts to tie the MySQL functions into PHP's session-handling functionality. Listing 3 is a script showing you how this function is used to integrate the MySQL functions.


Listing 3: Using session_set_save_handler() to integrate the MySQL functions



<?
INCLUDE("mysql_sessions.inc");

session_set_save_handler("mysql_session_open", "mysql_session_close",
  "mysql_session_select", "mysql_session_write",
  "mysql_session_destroy",
  "mysql_session_garbage_collect");

session_start();

// At this point, sessions can be used just as they were in the
// previous article!

?>


Conclusion

This wraps up this week's article, and also the conclusion of the two-part series on session tracking. The first article demonstrated how sessions can provide an invaluable addition to your Internet application, allowing for data to transparently follow a user. This article built upon what was learned in the first article, showing how it's possible to quickly create your own interface to the session functionality, making it possible to handle data via any PHP-supported media.

Next week, I turn my attention toward PHP's encryption capabilities, showing you how PHP's vast functionality can be used in collaboration with several of the most advanced encryption algorithms in the world.

W.J. Gilmore has been developing PHP applications since 1997, and is frequently published on the subject within some of the Web's most popular development sites. He is the author of 'A Programmer's Introduction to PHP 4.0' (January 2001, Apress), and is the Assistant Editorial Director of Web and Open Source Technologies at Apress.


Return to the PHP DevCenter.




Tagged Articles

Be the first to post this article to del.icio.us

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com