Class tgcSession

Description

tgcSession is a wrapper-class for PHP's session-functions

tgcSession is a wrapper-class for PHP's session-functions depending on the used version of PHP it uses a certain way of registering and unregistering session variables and so on

Located in /tgcSession.php (line 25)


	
			
Method Summary
 tgcSession tgcSession ([array $settings = array()])
 boolean decode (string $data)
 boolean destroy ([boolean $deleteGlobals = false])
 void dump ()
 string encode ()
 string getCacheLimiter ()
 array getCookieParams ()
 string getModuleName ()
 string getSavePath ()
 string getSessionId ()
 string getSessionName ()
 string getUrlString ()
 mixed getVar (string $varName)
 string get_sid ()
 string get_sid_string ()
 mixed get_var (string $varName)
 boolean isRegistered (string $varName)
 boolean regenerateId ()
 void ses_unset ()
 void setCookieParams (int $lifetime, [string $path = null], [string $domain = null], [boolean $secure = null])
 string setModuleName (string $newModuleName)
 boolean setSaveHandler (string $open, string $close, string $read, string $write, string $destroy, string $gc)
 void setVar (string $varName, mixed $varValue)
 void set_var (string $varName, mixed $varValue)
 void unsetAll ()
 void unsetVar (string $varName)
 void var_unset (string $varName)
 returns writeClose ()
Methods
Constructor tgcSession (line 100)

Constructor

Constructor the constructor has to be called before any headers are sent, it starts a new session or continues an existing one the param $settings indicates what has to be done before starting the session, it may contain the following items, each with a value to set:

   "setSavePath"     - set the path of the directory used to save session data
   "setSessionName"  - set the session-name
   "setSessionId"    - set the session-id
   "setCacheExpire"  - set the cache-expire time (since PHP 4.2.0)
   "setCacheLimiter" - set the name of the current cache limiter
 

tgcSession tgcSession ([array $settings = array()])
  • array $settings: settings to do before starting the session
decode (line 535)

decodes session data from a string

decodes session data from a string decodes the session data in $data and sets the variables stored in the session

boolean decode (string $data)
  • string $data: variable containing the session data as string
destroy (line 378)

deletes the session and its data

deletes the session and its data deletes the session and its data if the optional parameter is set to true, all global variables that belong to the session are deleted, too

boolean destroy ([boolean $deleteGlobals = false])
  • boolean $deleteGlobals: delete globals that belong to the session
dump (line 395)

displays the variables currently stored in the session

displays the variables currently stored in the session displays the variables currently stored in the session and some information about the object

  • access: public
void dump ()
encode (line 550)

encodes the current session data as a string

encodes the current session data as a string returns a string with the contents of the current session encoded within

  • return: string with the contents of the current session encoded within
  • see: tgcSession::decode()
  • access: public
string encode ()
getCacheExpire (line 438)

returns the cache-expire time

returns the cache-expire time returns the current cache-expire time on success, else the return-value is -1 (since PHP >= 4.2.0) as this method does nothing else than using PHP's session_cache_expire() please see http://www.php.net/manual/en/function.session-cache-expire.php for more information

int getCacheExpire ()
getCacheLimiter (line 487)

returns the current cache limiter

returns the current cache limiter returns the name of the current cache limiter (since PHP >= 4.0.3) as this method does nothing else than using PHP's session_cache_limiter() please see http://www.php.net/manual/en/function.session-cache-limiter.php for more information

string getCacheLimiter ()
getCookieParams (line 579)

returns the sessions cookie parameters

returns the sessions cookie parameters returns an array with the current session cookie information, the array contains the following items: "lifetime" - the lifetime of the cookie "path" - the path where information is stored "domain" - the domain of the cookie "secure" - the cookie should only be sent over secure connections. (This item was added in PHP 4.0.4.) as this method does nothing else than using PHP's session_get_cookie_params() please see http://www.php.net/manual/en/function.session-get-cookie-params.php for more information

array getCookieParams ()
getModuleName (line 631)

returns the session module

returns the session module returns the name of the current session module

string getModuleName ()
getSavePath (line 723)

returns the current session save path

returns the current session save path returns the path of the current directory used to save session data

string getSavePath ()
getSessionId (line 265)

returns the session-id

returns the session-id returns the current session-id

string getSessionId ()
getSessionName (line 662)

returns the session-name

returns the session-name returns the name of the current session

string getSessionName ()
getUrlString (line 238)

returns a string to append on URLs

returns a string to append on URLs this method returns a string like PHPSESSID=f57168af293ea522be176cc13abd5aa3 that can be appended to an URL if necessary

  • return: String consisting of session-name and session-id
  • access: public
string getUrlString ()
getVar (line 201)

returns a session variable

returns a session variable this method returns the value stored in the current session under the given name

mixed getVar (string $varName)
  • string $varName: name of the session variable
get_sid (line 250)
  • return: session-id
  • see: tgcSession::getVar()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use getSessionId() instead.
  • access: public
string get_sid ()
get_sid_string (line 223)
  • return: string consisting of session-name and session-id
  • see: tgcSession::getUrlString()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use getUrlString() instead.
  • access: public
string get_sid_string ()
get_var (line 185)
  • return: value stored under the given name
  • see: tgcSession::getVar()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use getVar() instead.
  • access: public
mixed get_var (string $varName)
  • string $varName: name of the session variable
isRegistered (line 616)

checks whether a variable with $varName is registered in the current session

checks whether a variable with $varName is registered in the current session returns true if there is a variable with the name $varName registered in the current session

  • return: true if such a variable is registered, else false
  • access: public
boolean isRegistered (string $varName)
  • string $varName: name of the variable
regenerateId (line 701)

updates the current session id with a newly generated one

updates the current session id with a newly generated one replaces the current session id with a new one, and keeps the current session information - available since PHP 4.3.2 or higher as this method does nothing else than using PHP's session_regenerate_id() please see http://www.php.net/manual/en/function.session-regenerate-id.php for more information

  • return: returns true on success, else false
  • access: public
boolean regenerateId ()
ses_unset (line 336)
  • see: tgcSession::unsetAll()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use unsetAll() instead.
  • access: public
void ses_unset ()
setCookieParams (line 601)

sets the sessions cookie parameters

sets the sessions cookie parameters sets cookie parameters defined in the php.ini file , the effect of this method only lasts for the duration of the script as this method does nothing else than using PHP's session_set_cookie_params() please see http://www.php.net/manual/en/function.session-set-cookie-params.php for more information

void setCookieParams (int $lifetime, [string $path = null], [string $domain = null], [boolean $secure = null])
  • int $lifetime: the lifetime of the cookie
  • string $path: the path where information is stored
  • string $domain: the domain of the cookie
  • boolean $secure: the cookie should only be sent over secure connections. (This item was added in PHP 4.0.4.)
setModuleName (line 647)

sets the session module

sets the session module sets the name of the session module that has to be used

string setModuleName (string $newModuleName)
  • string $newModuleName: name of the new session module
setSaveHandler (line 768)

sets user-level session storage functions

sets user-level session storage functions sets the user-level session storage functions which are used for storing and retrieving data associated with a session this is most useful when a storage method other than those supplied by PHP sessions is preferred. i.e. Storing the session data in a local database as this method does nothing else than using PHP's session_set_save_handler() please see http://www.php.net/manual/en/function.session-set-save-handler.php for more information

  • return: returns true on success or false on failure
  • access: public
boolean setSaveHandler (string $open, string $close, string $read, string $write, string $destroy, string $gc)
  • string $open
  • string $close
  • string $read
  • string $write
  • string $destroy
  • string $gc
setVar (line 157)

add a variable/object to the session

add a variable/object to the session use this method to add a new variable or object to the current session

void setVar (string $varName, mixed $varValue)
  • string $varName: name of the session variable
  • mixed $varValue: value to be stored in the session under this certain name
set_var (line 141)
  • see: tgcSession::setVar()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use setVar() instead.
  • access: public
void set_var (string $varName, mixed $varValue)
  • string $varName: name of the session variable
  • mixed $varValue: value to be stored in the session under this certain name
unsetAll (line 350)

unsets all session variables

unsets all session variables use this method to unset every variable you stored in the session

void unsetAll ()
unsetVar (line 311)

unsets a session variable

unsets a session variable use this method to remove a certain variable from the session

void unsetVar (string $varName)
  • string $varName: name of the variable
var_unset (line 296)
  • see: tgcSession::unsetVar()
  • deprecated: Don't use this method anymore as it will disappear in the next release. Use unsetVar() instead.
  • access: public
void var_unset (string $varName)
  • string $varName: name of the variable
writeClose (line 785)

write session data and end session

write session data and end session ends the current session and stores session data (since PHP >= 4.0.4) as this method does nothing else than using PHP's session_write_close() please see http://www.php.net/manual/en/function.session-write-close.php for more information

  • return: true on success, else false
  • access: public
returns writeClose ()

Documentation generated on Fri, 19 Nov 2004 23:40:46 +0100 by phpDocumentor 1.2.3