From: Christopher Kings-L. <ch...@us...> - 2005-05-30 07:34:01
|
Update of /cvsroot/planeshift/SC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv367 Modified Files: database.php index_login.php login.php p0.html Log Message: Fix the login system to avoid using variables that clobber variables needed for accounts admin. Index: database.php =================================================================== RCS file: /cvsroot/planeshift/SC/database.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** database.php 29 May 2005 08:33:08 -0000 1.33 --- database.php 30 May 2005 07:33:51 -0000 1.34 *************** *** 248,252 **** $sql = substr($sql, 0, -2); } ! return $this->executeSQL($sql); } --- 248,252 ---- $sql = substr($sql, 0, -2); } ! return $this->executeSQL($sql); } *************** *** 811,814 **** --- 811,816 ---- Database::Database(); } + + // Authentication functions function validateUser(&$vars) { *************** *** 816,820 **** $sqlFields = $this->XMLFields['name']; $sqlWhere['fields'] = array("username", "password"); ! $sqlWhere['values'] = array($vars['username'], md5($vars['password'])); return $this->getSingleRecordByFields($sqlFields, $sqlWhere, "accounts"); } --- 818,822 ---- $sqlFields = $this->XMLFields['name']; $sqlWhere['fields'] = array("username", "password"); ! $sqlWhere['values'] = array($vars['sc_username'], md5($vars['sc_password'])); return $this->getSingleRecordByFields($sqlFields, $sqlWhere, "accounts"); } *************** *** 838,841 **** --- 840,856 ---- } } + + // General search and editing functions + + function getAccountsFromSearch($sqlWhere, $order_by=null) { + $this->getFieldsByXML("accounts"); + $sqlFields = $this->getXMLListFields(); + if($order_by==null) { + $order_by[0] = "username"; + } + return $this->getAllByIDLike($sqlFields, $sqlWhere, "accounts", $order_by); + } + + } Index: index_login.php =================================================================== RCS file: /cvsroot/planeshift/SC/index_login.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** index_login.php 25 Mar 2005 04:44:33 -0000 1.1.1.1 --- index_login.php 30 May 2005 07:33:51 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- require_once("settings.php"); // }}} + $vars['MIDDLEHEADER'] = "Login"; $myLogin = new Login($vars); Index: login.php =================================================================== RCS file: /cvsroot/planeshift/SC/login.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** login.php 27 May 2005 08:44:58 -0000 1.4 --- login.php 30 May 2005 07:33:51 -0000 1.5 *************** *** 25,33 **** if(isset($_COOKIE['autologin'])) { $vars['AUTO_LOGGED'] = 'checked'; ! if(isset($vars['username']) || isset($vars['password'])) { } else { ! $vars['username'] = $_COOKIE['username']; ! $vars['password'] = $_COOKIE['password']; } $this->validateUser(null); --- 25,33 ---- if(isset($_COOKIE['autologin'])) { $vars['AUTO_LOGGED'] = 'checked'; ! if(isset($vars['sc_username']) || isset($vars['sc_password'])) { } else { ! $vars['sc_username'] = $_COOKIE['sc_username']; ! $vars['sc_password'] = $_COOKIE['sc_password']; } $this->validateUser(null); *************** *** 49,53 **** $this->userLoggedIn = true; // echo "setting session: " . $rs->fields['id']; ! session_register('username'); session_register('security_level'); session_register('uid'); --- 49,53 ---- $this->userLoggedIn = true; // echo "setting session: " . $rs->fields['id']; ! session_register('sc_username'); session_register('security_level'); session_register('uid'); *************** *** 60,70 **** if($vars['autoLogin'] == 1) { setcookie("autologin", "1", time() + (60 * 60 * 24 * 30)); ! setcookie("username", $vars['username'], time() + (60 * 60 * 24 * 30)); ! setcookie("password", $vars['password'], time() + (60 * 60 * 24 * 30)); } else { setcookie("autologin", "", time() - 3600); ! setcookie("username", "", time() - 3600); ! setcookie("password", "", time() - 3600); } --- 60,70 ---- if($vars['autoLogin'] == 1) { setcookie("autologin", "1", time() + (60 * 60 * 24 * 30)); ! setcookie("sc_username", $vars['sc_username'], time() + (60 * 60 * 24 * 30)); ! setcookie("sc_password", $vars['sc_password'], time() + (60 * 60 * 24 * 30)); } else { setcookie("autologin", "", time() - 3600); ! setcookie("sc_username", "", time() - 3600); ! setcookie("sc_password", "", time() - 3600); } Index: p0.html =================================================================== RCS file: /cvsroot/planeshift/SC/p0.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** p0.html 28 Apr 2005 08:56:39 -0000 1.2 --- p0.html 30 May 2005 07:33:51 -0000 1.3 *************** *** 10,18 **** <tr> <td class='labelcell'>Login: </td> ! <td class='fieldcell'><input type='text' name='username' value='{$USERNAME_VAL}'></td> </tr> <tr> <td class='labelcell'>Password: </td> ! <td class='fieldcell'><input type='password' name='password' value='{$PASSWORD_VAL}'></td> </tr> <tr> --- 10,18 ---- <tr> <td class='labelcell'>Login: </td> ! <td class='fieldcell'><input type='text' name='sc_username' value='{$SC_USERNAME_VAL}'></td> </tr> <tr> <td class='labelcell'>Password: </td> ! <td class='fieldcell'><input type='password' name='sc_password' value='{$SC_PASSWORD_VAL}'></td> </tr> <tr> |