PHPBuilder - Session Management and Authentication with PHPLIB Page 3

RSS Twitter

Session Management and Authentication with PHPLIB - Page 3

by: Chad Cunningham
July 30, 2000

Session Management is not just for authentication purposes though, it can even be used without authentication at all. You may use it to store any information you want, and this information will be available to all other pages the user visits which you have enabled with phplib session management. To use it, you simply register the variable you want to become persistent to other pages. This is done with a simple call like:
<?php $sess->register("variable_name"); ?>
Note that you do not use the $variable notation, simply a string containing the name of the variable you want to register. This is because when you register a variable, you are making that variable (as in the variable name) persistent, NOT the contents of that variable (it's value). Thus, if you change the value of a persistent variable on subsequent pages, the value of the session variable will change as well.That's all! That variable (be it a string, number, array, even an object) will be available to you on all further session pages. For example, let's say page1.php3 is passed some user info from a form. Let's say it get's the variable $firstname. You can then do:


if (
check($firstname)) {
$first $firstname;


« Previous Page
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Chad Cunningham



(Maximum characters: 1200). You have characters left.