[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/system/ -> lib-sessions.php (sommaire)

This is the session management library for Geeklog.  Some of this code was borrowed from phpBB 1.4.x which is also GPL'd

Poids: 475 lignes (18 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 8 fonctions

  SESS_sessionCheck()
  SESS_newSession()
  SESS_setSessionCookie()
  SESS_getUserIdFromSession()
  SESS_updateSessionTime()
  SESS_endUserSession()
  SESS_getUserData()
  SESS_getUserDataFromId()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

SESS_sessionCheck()   X-Ref
This gets the state for the user

Much of this code if from phpBB (www.phpbb.org).  This checks the session
cookie and long term cookie to get the users state.

return: array   returns $_USER array

SESS_newSession($userid, $remote_ip, $lifespan, $md5_based=0)   X-Ref
Creates new user session (short term cookie)

Adds a new session to the database for the given userid and returns a new session ID.
Also deletes all expired sessions from the database, based on the given session lifespan.

param: int         $userid         User ID to create session for
param: string      $remote_ip      IP address user is connected from
param: string      $lifespan       How long (seconds) this cookie should persist
param: string      $md5_based      If 1 session will be MD5 hash of ip address
return: string      Session ID

SESS_setSessionCookie($sessid, $cookietime, $cookiename, $cookiepath, $cookiedomain, $cookiesecure)   X-Ref
Sets the session cookie

This saves the session ID to the session cookie on client's machine for
later use

param: string      $sessid         Session ID to save to cookie
param: int         $cookietime     Cookie timeout value (not used)
param: string      $cookiename     Name of cookie to save sessiond ID to
param: string      $cookiepath     Path in which cookie should be sent to server for
param: string      $cookiedomain   Domain in which cookie should be sent to server for
param: int         $cookiesecure   if =1, set cookie only on https connection

SESS_getUserIdFromSession($sessid, $cookietime, $remote_ip, $md5_based=0)   X-Ref
Gets the user id from Session ID

Returns the userID associated with the given session, based on
the given session lifespan $cookietime and the given remote IP
address. If no match found, returns 0.

param: string      $sessid         Session ID to get user ID from
param: string      $cookietime     Used to query DB for valid sessions
param: string      $remote_ip      Used to pull session we need
param: int         $md5_based      Let's us now if we need to take MD5 hash into consideration
return: int         User ID

SESS_updateSessionTime($sessid, $md5_based=0)   X-Ref
Updates a session cookies timeout

Refresh the start_time of the given session in the database.
This is called whenever a page is hit by a user with a valid session.

param: string      $sessid     Session ID to update time for
param: int         $md5_based  Indicates if sessid is MD5 hash
return: boolean     always true for some reason

SESS_endUserSession($userid)   X-Ref
This ends a user session

Delete the given session from the database. Used by the logout page.

param: int     $userid     User ID to end session of
return: boolean     Always true for some reason

SESS_getUserData($username)   X-Ref
Gets a user's data

Gets user's data based on their username

param: string     $username        Username of user to get data for
return: array       returns user's data in an array

SESS_getUserDataFromId($userid)   X-Ref
Gets user's data

Gets user's data based on their user id

param: int     $userid     User ID of user to get data for
return: array   returns user'd data in an array



Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics