cvs: pear /Perm_LiveUser/Auth/Container DB.php MDB.php MDB2.php

From: Date: Mon, 05 Jul 2004 06:22:41 +0000
Subject: cvs: pear /Perm_LiveUser/Auth/Container DB.php MDB.php MDB2.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21518@lists.php.net to get a copy of this message
dufuz Mon Jul 5 02:22:41 2004 EDT Modified files: /pear/Perm_LiveUser/Auth/Container DB.php MDB2.php MDB.php Log: Moved a bits for the sql in userExists and takes now lesser space, and MDB[2] was checking for handle when it should have been checking for passwd in userExists

http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/DB.php?r1=1.57&r2=1.58&ty=u Index: pear/Perm_LiveUser/Auth/Container/DB.php diff -u pear/Perm_LiveUser/Auth/Container/DB.php:1.57 pear/Perm_LiveUser/Auth/Container/DB.php:1.58 --- pear/Perm_LiveUser/Auth/Container/DB.php:1.57 Mon Jun 21 18:19:13 2004 +++ pear/Perm_LiveUser/Auth/Container/DB.php Mon Jul 5 02:22:41 2004 @@ -44,7 +44,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: DB.php,v 1.57 2004/06/21 22:19:13 arnaud Exp $ + * @version $Id: DB.php,v 1.58 2004/07/05 06:22:41 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -290,22 +290,19 @@ return false; } + $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id'] . ' + FROM ' . $this->authTable; + if ($checkHandle !== false && $checkPW === false) { // only search for the first user with the given handle - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($checkHandle); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($checkHandle); } elseif ($checkHandle === false && $checkPW !== false) { // only search for the first user with the given password - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($checkPW)); + $sql .= 'WHERE ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($checkPW)); } else { // check for a user with both handle and password matching - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id'].' - FROM ' . $this->authTable.' - WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($checkHandle) . ' - AND ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($checkPW)); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($checkHandle) . ' + AND ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($checkPW)); } $result = $this->dbc->getOne($sql); http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/MDB2.php?r1=1.17&r2=1.18&ty=u Index: pear/Perm_LiveUser/Auth/Container/MDB2.php diff -u pear/Perm_LiveUser/Auth/Container/MDB2.php:1.17 pear/Perm_LiveUser/Auth/Container/MDB2.php:1.18 --- pear/Perm_LiveUser/Auth/Container/MDB2.php:1.17 Wed Jun 23 15:57:42 2004 +++ pear/Perm_LiveUser/Auth/Container/MDB2.php Mon Jul 5 02:22:41 2004 @@ -48,7 +48,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: MDB2.php,v 1.17 2004/06/23 19:57:42 arnaud Exp $ + * @version $Id: MDB2.php,v 1.18 2004/07/05 06:22:41 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -301,22 +301,19 @@ return false; } + $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' + FROM ' . $this->authTable; + if ($checkHandle !== false && $checkPW === false) { // only search for the first user with the given handle - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($checkHandle, $this->authTableCols['required']['handle']['type']); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($checkHandle, $this->authTableCols['required']['handle']['type']); } elseif ($checkHandle === false && $checkPW !== false) { // only search for the first user with the given password - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($this->encryptPW($checkPW), $this->authTableCols['required']['passwd']['type']); + $sql .= 'WHERE ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->quote($this->encryptPW($checkPW), $this->authTableCols['required']['passwd']['type']); } else { // check for a user with both handle and password matching - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($checkHandle, $this->authTableCols['required']['handle']['type']) . ' - AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->quote($this->encryptPW($checkPW), $this->authTableCols['required']['passwd']['type']); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($checkHandle, $this->authTableCols['required']['handle']['type']) . ' + AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->quote($this->encryptPW($checkPW), $this->authTableCols['required']['passwd']['type']); } $result = $this->dbc->queryOne($sql, $this->authTableCols['required']['auth_user_id']['type']); http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/MDB.php?r1=1.37&r2=1.38&ty=u Index: pear/Perm_LiveUser/Auth/Container/MDB.php diff -u pear/Perm_LiveUser/Auth/Container/MDB.php:1.37 pear/Perm_LiveUser/Auth/Container/MDB.php:1.38 --- pear/Perm_LiveUser/Auth/Container/MDB.php:1.37 Mon Jun 21 18:19:13 2004 +++ pear/Perm_LiveUser/Auth/Container/MDB.php Mon Jul 5 02:22:41 2004 @@ -45,7 +45,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: MDB.php,v 1.37 2004/06/21 22:19:13 arnaud Exp $ + * @version $Id: MDB.php,v 1.38 2004/07/05 06:22:41 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -301,22 +301,19 @@ return false; } + $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' + FROM ' . $this->authTable; + if ($checkHandle !== false && $checkPW === false) { // only search for the first user with the given handle - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['handle']['type'], $checkHandle); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['handle']['type'], $checkHandle); } elseif ($checkHandle === false && $checkPW !== false) { // only search for the first user with the given password - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['passwd']['type'], $this->encryptPW($checkPW)); + $sql .= 'WHERE ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['passwd']['type'], $this->encryptPW($checkPW)); } else { // check for a user with both handle and password matching - $sql = 'SELECT ' . $this->authTableCols['required']['auth_user_id']['name'] . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['handle']['type'], $checkHandle) . ' - AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['passwd']['type'], $this->encryptPW($checkPW)); + $sql .= 'WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['handle']['type'], $checkHandle) . ' + AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['required']['passwd']['type'], $this->encryptPW($checkPW)); } $result = $this->dbc->queryOne($sql, $this->authTableCols['required']['auth_user_id']['type']);
« previous php.pear.cvs (#21518) next »