Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Procedural File: lib-sessions.php

Source Location: /system/lib-sessions.php



Page Details:

This is the session management library for Geeklog. Some of this code was

borrowed from phpBB 1.4.x which is also GPL'd










SESS_endUserSession [line 438]

boolean SESS_endUserSession( int $userid)

This ends a user session

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




Tags:

return:  Always true for some reason


Parameters

int   $userid   User ID to end session of
[ Top ]



SESS_getUserData [line 456]

array SESS_getUserData( string $username)

Gets a user's data

Gets user's data based on their username




Tags:

return:  returns user's data in an array


Parameters

string   $username   Username of user to get data for
[ Top ]



SESS_getUserDataFromId [line 484]

array SESS_getUserDataFromId( int $userid)

Gets user's data

Gets user's data based on their user id




Tags:

return:  returns user's data in an array


Parameters

int   $userid   User ID of user to get data for
[ Top ]



SESS_getUserIdFromSession [line 365]

int SESS_getUserIdFromSession( string $sessid, string $cookietime, string $remote_ip, [int $md5_based = 0])

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.




Tags:

return:  User ID


Parameters

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



SESS_newSession [line 252]

string SESS_newSession( int $userid, string $remote_ip, string $lifespan, [string $md5_based = 0])

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.




Tags:

return:  Session ID


Parameters

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



SESS_sessionCheck [line 77]

array SESS_sessionCheck( )

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.




Tags:

return:  returns $_USER array


[ Top ]



SESS_setSessionCookie [line 335]

void SESS_setSessionCookie( string $sessid, int $cookietime, string $cookiename, string $cookiepath, string $cookiedomain, int $cookiesecure)

Sets the session cookie

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




Parameters

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



SESS_updateSessionTime [line 412]

boolean SESS_updateSessionTime( string $sessid, [int $md5_based = 0])

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.




Tags:

return:  always true for some reason


Parameters

string   $sessid   Session ID to update time for
int   $md5_based   Indicates if sessid is MD5 hash
[ Top ]



Documentation generated on Sat, 11 Feb 2012 02:08:28 -0500 by phpDocumentor 1.4.3