[phpMP-CVS] CVS: phpMP/includes user.php,1.7,1.8
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2003-01-14 22:42:34
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv24935/includes Modified Files: user.php Log Message: Check out the Changelog. Index: user.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/user.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** user.php 5 Dec 2002 22:27:47 -0000 1.7 --- user.php 14 Jan 2003 22:42:31 -0000 1.8 *************** *** 5,9 **** { ! function snapshot( $user ) { --- 5,13 ---- { ! // Fetches user information/variables from the database. ! // Author: Brian 'Heimidal' Rose ! // Accepts: $user (integer). ! // Returns: boolean. ! function _snapshot( $user ) { *************** *** 14,29 **** $qry = $DB->query($sql); ! $user_array = $DB->fetchArray($qry); ! while( list ($key, $val) = each ($user_array) ) ! { ! if( $val != '' ) { ! define( "U_" . strtoupper($key), $val ); } ! } ! } ! function sessionClean() { --- 18,45 ---- $qry = $DB->query($sql); ! if( $DB->numRows( $qry ) < 1 ) { ! return false; ! ! } ! else { ! $user_array = $DB->fetchArray($qry); ! ! while( list ($key, $val) = each ($user_array) ) { ! if( $val != '' ) ! { ! define( "U_" . strtoupper($key), $val ); ! } } ! ! return true; ! } } ! ! // Session cleanup routine. ! // Author: Brian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. function sessionClean() { *************** *** 32,36 **** $rand = rand(0,10); ! if($rand >= 1) { --- 48,52 ---- $rand = rand(0,10); ! if($rand >= 1) // 1:10 chance of session cleanup. This may later become a setting. { *************** *** 42,45 **** --- 58,65 ---- } + // User initialization function. Does -EVERYTHING- except explicit session cleanup. + // Author: Brian 'Heimidal' Rose + // Accepts: none. + // Returns: none. function User() { *************** *** 49,53 **** // Must decide is this is an anonymous user or a registered user. ! if( C_USE_PERMS == 1 ) { --- 69,73 ---- // Must decide is this is an anonymous user or a registered user. ! if( ( C_USE_PERMS == 1 ) || ( P_ADMIN_REQ ) ) // Checks for use_perms setting and makes sure we're not entering the admin area. { *************** *** 57,63 **** include_once( C_PHPMP_ROOT . 'includes/auth.php' ); ! $Auth = new Auth(); ! $this->snapshot( $Auth->curr_user ); } --- 77,83 ---- include_once( C_PHPMP_ROOT . 'includes/auth.php' ); ! $Auth = new Auth(); // Initializes Auth, which also authenticates the user. ! $this->_snapshot( $Auth->curr_user ); // Gets snapshot of user info/vars. } *************** *** 65,69 **** { ! $this->snapshot('1'); } --- 85,89 ---- { ! $this->_snapshot('1'); // Gets snapshot of anon user info/vars. } |