replaced two DB queries with one that is indexed.
authorArun Persaud <arun@nubati.net>
Tue, 26 Feb 2013 05:25:57 +0000 (21:25 -0800)
committerArun Persaud <arun@nubati.net>
Tue, 26 Feb 2013 05:25:57 +0000 (21:25 -0800)
include/db.php
include/user.php

index 3be9494..6568e75 100644 (file)
@@ -141,16 +141,6 @@ function DB_get_version()
   return $version[0];
 }
 
-function DB_get_passwd_by_name($name)
-{
-  $r = DB_query_array("SELECT password FROM User WHERE fullname=".DB_quote_smart($name)."");
-
-  if($r)
-    return $r[0];
-  else
-    return "";
-}
-
 function DB_get_passwd_by_userid($id)
 {
   $r = DB_query_array("SELECT password FROM User WHERE id=".DB_quote_smart($id)."");
index 6169495..546ea8d 100644 (file)
@@ -25,11 +25,15 @@ if(!isset($HOST))
   exit;
 
 /* test id and password, should really be done in one step */
-if(isset($_SESSION['name']))
+if(isset($_SESSION['id']))
   {
-    $name = $_SESSION['name'];
-    $email     = DB_get_email('name',$name);
-    $password  = DB_get_passwd_by_name($name);
+    $myid = $_SESSION['id'];
+    $r = DB_query_array("SELECT email,password FROM User WHERE id=".DB_quote_smart($myid)."");
+    if($r)
+      {
+       $email     = $r[0];
+       $password  = $r[1];
+      };
   };
 
 global  $ADMIN_NAME;