README:
b3co Session Handler v0.1
scripts included
-config.ses.php: has all functions and declarations (db, etc)
-session.ses.php: initiates or handles a session
-test.php: is a tiny EXAMPLE script for test session settings
-end.php: is a tiny EXAMPLE script that shows how to end a session
-install.php: this file makes the two needed tables in db
-info.php: shows your server settings
instalation guide
all you have to do is place *ses.php scripts in your include path
edit config.ses.php file to set your mysql username, password, db,
table names also a securekey that will be used to set session ids,
session timeout.
after you have modified config.ses.php you have two choices:
a) run install.php file that will create needed tables in your db
(mysql user must have permisions), or:
b) execute the following sql scripts in your mysql terminal (shell, phpmyadmin, etc)
---------start sql----------------
CREATE TABLE `session_master` (
`sid` VARCHAR( 100 ) NOT NULL ,
`variable` VARCHAR( 255 ) NOT NULL ,
`value` VARCHAR( 255 ) NOT NULL ,
INDEX ( `sid` )
);
CREATE TABLE `session_global` (
`id` INT NOT NULL AUTO_INCREMENT ,
`sid` VARCHAR( 255 ) NOT NULL ,
`start` DATETIME NOT NULL ,
`last` DATETIME NOT NULL ,
`ip` VARCHAR( 20 ) NOT NULL ,
`logout` TINYINT( 0 ) NOT NULL ,
PRIMARY KEY ( `sid` ) ,
UNIQUE (`id`)
);
-----------end sql------------------
voila, you now have an excelent session manager to bookmark your visitors
use guide
this system allows to handle any variable in a session
in all your php pages that you want to use session you have to place
the following line BEFORE ANY OUTPUT (be carefull: even blank spaces or
blank lines before '<?php' are output)
include 'session.ses.php';
all your session variables will be stored in $_session (not $_SESSION)
and you can acces them as
$_session['name']
to register a variable in a session use:
set_session_var(name, value)
this line will make an insert into $_db_table to store variable value
after set_session_var, $_session will contain at place 'name' value 'value'
DO NOT modify $_session values in any other way like
<DO NO DO THIS> $_session['foo'] = 'var'</DO NOT DO THIS>
because that variable will not be updated during session life into db
see FUNCTIONS file for detailed explanation of every function
Other Development Tools Scripts: