How do I use Trax Sessions

From PHP on Trax
Jump to: navigation, search

Contents

Create the session store table

 CREATE TABLE sessions(
   id varchar( 100 ) NOT NULL default ,
   client_ip varchar( 20 ) default NULL ,
   http_user_agent varchar( 150 ) default NULL ,
   DATA text default NULL ,
   created_at datetime default NULL ,
   updated_at datetime default NULL ,
   PRIMARY KEY ( id )
 )

Functions

Start/End a Session

 Session::start();            //Start or continue a session
 Session::destroy();          //Destroy all data registered the session

Set/Get Session Variables

 Session::set($key,$value);   //$key Key to identify one particular session variable of potentially many for this session
 Session::get($key);          //$value Value stored in the session variable identified by $key
 
 Session::isset_var($key);    //Test whether a session variable is defined
 Session::isset_flash($key);  //Test whether there is a flash message to be shown
 Session::flash($key, $value);//Get or set a flash message that will appear prominently on the next screen to be sent to the user.
 
 Session::unset_session();    //Unset the session variable
 Session::unset_var($key);    //Unset a session variable
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox