From: <jhe...@us...> - 2002-08-05 08:39:13
|
Update of /cvsroot/upcase-project/UpCase/lib In directory usw-pr-cvs1:/tmp/cvs-serv3913 Modified Files: uc_session.php Log Message: Moved checkPassword as a method of UcSession Index: uc_session.php =================================================================== RCS file: /cvsroot/upcase-project/UpCase/lib/uc_session.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** uc_session.php 16 Jul 2002 15:31:57 -0000 1.1.1.1 --- uc_session.php 5 Aug 2002 08:39:10 -0000 1.2 *************** *** 3,23 **** include_once("config/uc_config.inc"); include_once("lib/uc_accounts.php"); ! $SESSION_DATA = "uc_session_data"; include_once("lib/uc_session_handler.php"); - function checkPassword($username, $password) - { - global $ucsql_usercheckpw; - $query = sprintf($ucsql_usercheckpw, $username, $password); - $db = new UcSQL(); - $res = $db->Execute($query) or die("Unable to check password: " - . $db->ErrorMsg()); - if ($res->RowCount() != 1) - { - return false; - } - return true; - } --- 3,11 ---- include_once("config/uc_config.inc"); include_once("lib/uc_accounts.php"); + include_once("lib/uc_login.php"); ! $SESSION_DATA = "uc1_session_data"; include_once("lib/uc_session_handler.php"); *************** *** 84,89 **** // No IP set in the session, do it now $query = sprintf($ucsql_sessionsetip, $ip, $this->sessid); ! $this->db->Execute($query) or die("Unable to set IP for the session: " ! . $this->db->ErrorMsg()); return true; } --- 72,78 ---- // No IP set in the session, do it now $query = sprintf($ucsql_sessionsetip, $ip, $this->sessid); ! $res = $this->db->Execute($query) or ! die("Unable to set IP for the session: " . $this->db->ErrorMsg()); ! return true; } *************** *** 98,103 **** // retrieve the uid associated with this session from the db $query = sprintf($ucsql_sessionget, $this->sessid); ! $res = $this->db->Execute($query) or die("Unable to get session info: " ! . $this->db->ErrorMsg()); $o = $res->FetchNextObject(true); --- 87,92 ---- // retrieve the uid associated with this session from the db $query = sprintf($ucsql_sessionget, $this->sessid); ! $res = $this->db->Execute($query) or ! die("Unable to get session info: " . $this->db->ErrorMsg()); $o = $res->FetchNextObject(true); *************** *** 113,117 **** { // we have the password/login ! if (checkPassword($username, $password)) { // good, update session with user --- 102,106 ---- { // we have the password/login ! if ($this->checkPassword($username, $password)) { // good, update session with user *************** *** 127,131 **** else { ! // we don't have password/lohin, ask for it uc_login($this->returnPath); exit(); --- 116,120 ---- else { ! // we don't have password/login, ask for it uc_login($this->returnPath); exit(); *************** *** 141,157 **** $this->user = $user; $query = sprintf($ucsql_sessionlogin, $this->user->uid, $this->sessid); ! $this->db->Execute($query) or die("Unable to set session uid: " . ! $this->db->ErrorMsg()); } ! // function addVar($varname, $initialValue) ! // { ! // if (!session_is_registered($varname)) ! // { ! // session_register($varname); ! // $$varname = $initialValue; ! // } ! // } ! } --- 130,150 ---- $this->user = $user; $query = sprintf($ucsql_sessionlogin, $this->user->uid, $this->sessid); ! $res = $this->db->Execute($query) or ! die("Unable to set session uid: " . $this->db->ErrorMsg()); } ! function checkPassword($username, $password) ! { ! global $ucsql_usercheckpw; ! $query = sprintf($ucsql_usercheckpw, $username, $password); ! $res = $this->db->Execute($query) or ! die("Error while checking password: " . $this->db->ErrorMsg()); ! if ($res->RowCount() != 1) ! { ! return false; ! } ! return true; ! } ! } |