PHP Classes

File: sessMan.Readme.txt

Recommend this page to a friend!
  Classes of Albert van Dam   sessMan   sessMan.Readme.txt   Download  
File: sessMan.Readme.txt
Role: Documentation
Content type: text/plain
Description: Readme file
Class: sessMan
Session handler using PHP and MySQL
Author: By
Last change: Additional functionality to this class was documented
Date: 20 years ago
Size: 4,643 bytes


Class file image Download
*********************************************** *** *** *** sessMan *** *** Version 1.0 *** *** *** *** Albert van Dam *** *** Email: *** *** *** *********************************************** *** *** *** README *** *** *** *********************************************** sessMan is a session handler making use of PHP and MySQL. It has support for logins and sessions are linked to specific computers using their ip addresses. All database connections are made using my MySQL_DB_Connect class. If you need this to work on other database servers like MSSQL, PostegreSQL, Oracle, etc, modify that class to suit your needs. Please make sure you have the following files: * sessMan.demo.php : sessMan demo * sessMan.functions.txt : Summary of functions in class * : Session handler * sessMan.Readme.txt : This file and download the latest version of the MySQL_DB_Connect class from the PHP Classes website. You will need to edit the mysql_db_connect.cfg.php with your database settings, to be able to make the required database connections. After you have done that, create the following table in the chosen database: CREATE TABLE sessman ( id int(10) unsigned NOT NULL auto_increment, mid int(10) unsigned default '0', expiry varchar(20) default '0', sessid varchar(40) default '0', rtime varchar(50) default NULL, user_var_1 varchar(255) default NULL, user_var_2 varchar(255) default NULL, user_var_3 varchar(255) default NULL, user_var_4 varchar(255) default NULL, user_var_5 varchar(255) default NULL, user_var_6 varchar(255) default NULL, user_var_7 varchar(255) default NULL, user_var_8 varchar(255) default NULL, user_var_9 varchar(255) default NULL, user_var_10 varchar(255) default NULL, userIP varchar(100) default NULL, PRIMARY KEY (id) ); Then edit the sessMan.cfg.php file to contain the correct settings. This is only required if you are going to do logins using this class. $userTable : Table in which your username / password combinations are $userNameField : Field in the user table containing the usernames $userGroupIDField : Field in the user table containing the group id $passwordField : Field in the user table containing the password $userIDField : Field in the user table containing the user id $otherConditionField : Field in the user table that contain a condition. Leave empty if not required $otherConditionValue : Value condition must meet. Leave empty if not required $textPass : If TRUE the password is text; If FALSE the password is MD5 In every PHP script you will be using sessMan add the following code: require(""); $sessionVariable = new sessMan(); You need to create a session using: (Does not do login) $sessionID = $sessionVariable->create($userID); To do login: $sessionID = $sessionVariable->login($userName, $userPass); This will login the user and create a session. If the user is not valid a notice will be given and the script will die. Make sure you pass the session id to every page, otherwise your session will not be able to be validated and the script will die. Once you have created the session or logged in a user, you need to validate it everywhere you use it. You shouldn't call create() again as you will loose all the variables set. To validate call: $sessionVariable->validate($sessionID); You can set 10 variables using sessMan. To do this call: $sessionVariable->setVar1($value); Replacing the 1 with 1-10 as required. To retrieve the variables call: $sessionVariable->getVar1(); Replacing the 1 with 1-10 as required. The variables are character fields with length of 255. Check the summary of functions for more functionality, or bug me when neccesary at the above email address. You must set everything you want before calling validate(), create() or logout() If you make changes, please send me a copy. // !!!! SOUTH AFRICA ROCKS !!!! \\