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 431]

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_getSessionIdFromUserId [line 508]

string SESS_getSessionIdFromUserId( int $uid)

Gets the Session ID from the User Id

Returns the session id associated with the user if available. This is not for anonymous users. If no match found, returns an empty string.




Tags:

return:  Session ID


Parameters

int   $uid   User Id to retrieve session Id for
[ Top ]



SESS_getUserData [line 449]

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 477]

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 358]

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_getVariable [line 527]

string SESS_getVariable( string $variable)

Retrieves a session variable from the db



Tags:

return:  data from variable


Parameters

string   $variable   Variable name to retrieve
[ Top ]



SESS_newSession [line 226]

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 72]

void 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.




[ Top ]



SESS_setSessionCookie [line 327]

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_setVariable [line 552]

boolean SESS_setVariable( string $variable, string $value, [string $session_id = 0])

Updates a session variable from the db



Tags:

return:  always true for some reason


Parameters

string   $variable   Variable name to update
string   $value   Value of variable
string   $session_id   Session ID of variable to update (0 = current session)
[ Top ]



SESS_updateSessionTime [line 405]

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 Sun, 02 Oct 2016 07:51:38 +0000 by phpDocumentor 1.4.3