[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1534] switch login.php to adodb
From: |
Clint Adams |
Subject: |
[Librefm-commits] [1534] switch login.php to adodb |
Date: |
Tue, 12 May 2009 19:13:03 +0000 |
Revision: 1534
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1534
Author: clint
Date: 2009-05-12 19:13:03 +0000 (Tue, 12 May 2009)
Log Message:
-----------
switch login.php to adodb
Modified Paths:
--------------
trunk/nixtape/login.php
Modified: trunk/nixtape/login.php
===================================================================
--- trunk/nixtape/login.php 2009-05-12 19:03:39 UTC (rev 1533)
+++ trunk/nixtape/login.php 2009-05-12 19:13:03 UTC (rev 1534)
@@ -20,7 +20,7 @@
*/
-require_once('database.php');
+require_once('database2.php');
require_once('templating.php');
require_once($install_path . '/data/User.php');
@@ -44,12 +44,15 @@
}
if(empty($errors)) {
- $res = $mdb2->query('SELECT username FROM Users WHERE '
- . ' lower(username) = ' .
$mdb2->quote(strtolower($username), 'text')
- . ' AND password = ' . $mdb2->quote(md5($password),
'text') . ' AND active = 1');
- if(PEAR::isError($res)) {
+ try {
+ $res = $adodb->GetOne('SELECT username FROM Users WHERE '
+ . ' lower(username) = ' .
$adodb->qstr(strtolower($username))
+ . ' AND password = ' . $adodb->qstr(md5($password)) . '
AND active = 1');
+ }
+ catch (exception $e) {
$errors .= 'A database error happened.';
- } elseif(!$res->numRows()) {
+ }
+ if(!$res) {
$errors .= 'Invalid username or password.';
$smarty->assign('invalid', true);
} else {
@@ -60,10 +63,10 @@
} else {
$session_time = time() + 86400; // 1 day
}
- $mdb2->query('INSERT INTO Scrobble_Sessions (username,
sessionid, expires) VALUES ('
- . $mdb2->quote($username, 'text') . ', '
- . $mdb2->quote($session_id, 'text') . ', '
- . $mdb2->quote($session_time, 'integer') . ')');
+ $adodb->Execute('INSERT INTO Scrobble_Sessions
(username, sessionid, expires) VALUES ('
+ . $adodb->qstr($username) . ', '
+ . $adodb->qstr($session_id) . ', '
+ . (int)($session_time) . ')');
setcookie('session_id', $session_id, $session_time);
$logged_in = true;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1534] switch login.php to adodb,
Clint Adams <=