[phpMP-CVS] CVS: phpMP/includes core.php,1.50,1.51 session.php,1.9,1.10
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2003-05-12 07:05:15
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv21328/includes Modified Files: core.php session.php Log Message: Added per-session invisible mode. Index: core.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/core.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** core.php 9 May 2003 08:07:39 -0000 1.50 --- core.php 12 May 2003 07:05:10 -0000 1.51 *************** *** 40,44 **** } ! error_reporting(E_ERROR | E_WARNING | E_PARSE); //error_reporting(E_ALL); --- 40,44 ---- } ! error_reporting(E_ERROR /*| E_WARNING | E_PARSE*/); //error_reporting(E_ALL); Index: session.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/session.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** session.php 12 May 2003 05:06:56 -0000 1.9 --- session.php 12 May 2003 07:05:10 -0000 1.10 *************** *** 17,20 **** --- 17,22 ---- function start() { + // We'll only start a session if + // one hasn't already been started. if($this->started == false) { *************** *** 32,38 **** $this->page = basename($_SERVER['REQUEST_URI']); - $SID = "?sid="; - // Sets the session as owned by an anonymous user. $sql = "UPDATE " . DB_SESSIONS_TABLE . " SET session_exp_time=" . $exp_time . " --- 34,39 ---- $this->page = basename($_SERVER['REQUEST_URI']); // Sets the session as owned by an anonymous user. + // Since there's no reason to use a different session key, we'll keep that. $sql = "UPDATE " . DB_SESSIONS_TABLE . " SET session_exp_time=" . $exp_time . " *************** *** 43,48 **** $DB->query($sql); setcookie($Config->get('cookie_name') . '_auto', '', time() - 31536000, $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure')); ! setcookie($Config->get('cookie_name') . '_data', '', time() - 31536000, $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure')); } --- 44,53 ---- $DB->query($sql); + $this->session_user_id = ANONYMOUS; + setcookie($Config->get('cookie_name') . '_auto', '', time() - 31536000, $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure')); ! ! $cookie_data = urlencode( ANONYMOUS . ':' . $this->session_key ); ! (setcookie($Config->get('cookie_name') . '_data', $cookie_data, $cur_time + $Config->get('session_length'), $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure'))) ? ($SID = "?sid=") : ($SID = "?sid=" . $this->session_key); } *************** *** 57,61 **** $passwd_enc = md5($_POST['login_passwd']); $auto_login_set = $_POST['autologin']; ! $sql = "SELECT * FROM " . DB_USERS_TABLE . " WHERE user_name='" . addslashes($username) . "' --- 62,67 ---- $passwd_enc = md5($_POST['login_passwd']); $auto_login_set = $_POST['autologin']; ! $invisible_mode = $_POST['invisible_mode']; ! $sql = "SELECT * FROM " . DB_USERS_TABLE . " WHERE user_name='" . addslashes($username) . "' *************** *** 71,77 **** $this->is_logged_in = true; if( $auto_login_set == true ) { ! $auto_cookie_data = urlencode( $this->session_user_id . ':' . $passwd_enc ); setcookie($Config->get('cookie_name') . '_auto', $auto_cookie_data, time() + 31536000, $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure')); } --- 77,87 ---- $this->is_logged_in = true; + // We'll look into the invisible mode setting and ensure the user's wishes are met. + ($invisible_mode == true) ? ( $User->set('invisible_mode', 1) ) : ( $User->set('invisible_mode', 0) ); + + // We'll set up an autologin cookie if the user wants us to. if( $auto_login_set == true ) { ! $auto_cookie_data = urlencode( $this->session_user_id . ':' . $passwd_enc . ':' . $User->get('invisible_mode') ); setcookie($Config->get('cookie_name') . '_auto', $auto_cookie_data, time() + 31536000, $Config->get('cookie_path'), $Config->get('cookie_domain'), $Config->get('cookie_secure')); } *************** *** 79,83 **** else // Wrong login information. { ! die('Sorry. Your username and/or password are incorrect. '); } } --- 89,93 ---- else // Wrong login information. { ! die('Sorry. Your username and/or password are incorrect.'); } } *************** *** 245,248 **** --- 255,259 ---- { $User->set( $DB->fetchAssoc($result) ); + $User->set('invisible_mode', $auto_cookie_array[2]); $this->session_user_id = $auto_cookie_array[0]; $this->is_logged_in = true; |