Login   Register  
PHP Classes
elePHPant
Icontem

File: documentation.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of João Romão  >  MySessions  >  documentation.txt  >  Download  
File: documentation.txt
Role: Documentation
Content type: text/plain
Description: Documentation file
Class: MySessions
Handler that stores session data in a MySQL table
Author: By
Last change: Accessible without user login
Date: 6 years ago
Size: 10,083 bytes
 

Contents

Class file image Download
------------------------------------------------------------------------------------------------------------
	MySessions v1.0 - MySQL Based Sessions v1.0
	By João Romão (iceburn.info)
------------------------------------------------------------------------------------------------------------


Contents 



Package MySQL Classes                                                                1 

Class MySessions                                                                     1 

Class Constant always_regenerate                                                     1 

Var $cookie_domain                                                                   1 

Var $cookie_path                                                                     2 

Var $session_name                                                                    2 

Var $sess_duration                                                                   2 

Var $table_name                                                                      2 

Var $use_trans_id                                                                    3 

Constructor __construct                                                              3 

Method close                                                                         3 

Method create_table                                                                  3 

Method debug                                                                         4 

Method destroy                                                                       4 

Method gc                                                                            4 

Method open                                                                          5 

Method optimize                                                                      5 

Method read                                                                          5 

Method regenerate                                                                    6 

Method session_start                                                                 6 

Method write                                                                         6 

Method __destruct                                                                    7 



Appendices                                                                           8 

Appendix A - Class Trees                                                             9 

MySQL                                                                                9 



----------------------- Page 1 -----------------------

Package MySQL Classes 



Class MySessions 

[line 29] 

MySessions v1.0 



Package MySQL 

Author João Romão (aka =IceBurn=) 

Version 2008 

Copyright João Romão - iceburn.info 

Access public 



MySessions::always_regenerate 



bool =  true [line 38] 



Define if the session_id should be always regenerated 

Setting this to true will improve security,  but also increase memory usage. 



MySessions::$cookie_domain 



string =  '' [line 44] 



use: mydomain.com or leave blank OR .mydomain.com to keep sessions between sub- 

domains. 



Access public 



----------------------- Page 2 -----------------------

MySessions::$cookie_path 



string =  '/' [line 50] 



usually '/' it's just fine 



Access public 



MySessions::$session_name 



string =  'sess' [line 74] 



The name for the session (PHP's default is the ugly PHPSESSIONID) 



Access public 



MySessions::$sess_duration 



int =  2300 [line 56] 



Sessions lifetime in seconds 



Access public 



MySessions::$table_name 



string =  'sessions' [line 62] 



Table name to store sessions. 



----------------------- Page 3 -----------------------

Access public 



MySessions::$use_trans_id 



bool =  0 [line 68] 



Should sessions be passed to URL's? 0 = no / 1 = yes (not recomended!) 



Access public 



Constructor void function MySessions::__construct() [line 83] 

sessions::__construct() 



Access public 



bool function MySessions::close() [line 163] 

sessions::close() 



Access public 



bool function MySessions::create_table() [line 291] 

sessions::create_table() 

You can call this function at the first run to create the necessary table. No problem to call 

it after the table is created, but will increase memory. If the table does not exist, the very first 

call to sessions will be stored  as usual. It will always return true or die() if fail to create table. 



----------------------- Page 4-----------------------

Access public 



string function MySessions::debug() [line 322] 

MySessions::debug() 

Only for debugging reasons. 



Access public 



bool function MySessions::destroy($sess_id) [line 231] 

Function Parameters: 



mixed $sess_id 



sessions::destroy() 

Session destroy, useful for logouts 



Access public 



bool function MySessions::gc($sess_maxlifetime) [line 252] 

Function Parameters: 



mixed $sess_maxlifetime 



sessions::gc() 

Garbage collector 


----------------------- Page 5 -----------------------

Access public 



bool function MySessions::open($sess_path, $sess_name) [line 153] 

Function Parameters: 



mixed $sess_path 

mixed $sess_name 



sessions::open() 



Access public 



bool function MySessions::optimize() [line 276] 

sessions::optimize() 

Usefull function for optimizing your sessions table. 



Access public 



string function MySessions::read($sess_id) [line 175] 

Function Parameters: 



mixed $sess_id 



sessions::read() 



----------------------- Page 6 -----------------------

Access public 



bool function MySessions::regenerate([$force = 0]) [line 126] 

Function Parameters: 



integer $force 



MySessions::regenerate() 

A session is regenerated either if specified in configurations or if somehow an invalid 
session_id is passed or if implicit. 



Access public 



void function MySessions::session_start() [line 112] 

MySessions::session_start() 



Access public 



bool function MySessions::write($sess_id, $data) [line 205] 

Function Parameters: 



mixed $sess_id 

mixed $data 



sessions::write() 


----------------------- Page 7 -----------------------

Access public 



void function MySessions::__destruct() [line 334] 

MySessions::__destruct() 



Access public 



----------------------- Page 8 -----------------------

Appendices 



----------------------- Page 9 -----------------------

Appendix A - Class Trees 



Package MySQL 



MySessions 



MySessions 



----------------------- Page 12-----------------------

Index 



C 

constructor MySessions::__construct()                                                                      3 

sessions::__construct() 



M 

MySessions::optimize()                                                                                     5 

sessions::optimize() 

MySessions::open()                                                                                         5 

sessions::open() 

MySessions::gc()                                                                                           4 

sessions::gc() 

MySessions::destroy()                                                                                      4 

sessions::destroy() 

MySessions::read()                                                                                         5 

sessions::read() 

MySessions::regenerate()                                                                                   6 

MySessions::regenerate() 

MySessions::__destruct()                                                                                   7 

MySessions::__destruct() 

MySessions::write()                                                                                        6 

sessions::write() 

MySessions::session_start()                                                                                6 

MySessions::session_start() 

MySessions::debug()                                                                                        4 

MySessions::debug() 

MySessions::create_table()                                                                                 3 

sessions::create_table() 

MySessions::$cookie_path                                                                                   2 

usually '/' it's just fine 

MySessions::$cookie_domain                                                                                 1 

use: mydomain.com or leave blank OR .mydomain.com to keep sessions between sub- 

domains. 

MySessions::always_regenerate                                                                              1 

Define if the session_id should be always regenerated 

MySessions::$session_name                                                                                  2 

The name for the session (PHP's default is the ugly PHPSESSIONID) 

MySessions::$sess_duration                                                                                 2 

Sessions lifetime in seconds 

MySessions::close()                                                                                        3 

sessions::close() 

MySessions::$use_trans_id                                                                                  3 

Should sessions be passed to URL's? 0 = no / 1 = yes (not recomended!) 

MySessions::$table_name   
2 
Table name to store sessions. 


------------------------------------------------------------------------------------------------------------

MySessions v1.0 by João Romão 2008