includes/sessions.php
changeset 1032 9e61f16a8e47
parent 1026 f0431eb8161e
child 1063 46e08815594e
child 1065 18d013f98fd0
--- a/includes/sessions.php	Thu Jul 02 09:00:52 2009 -0400
+++ b/includes/sessions.php	Thu Jul 02 09:01:29 2009 -0400
@@ -658,7 +658,7 @@
     
     if ( !defined('IN_ENANO_INSTALL') )
     {
-      $locked_out = $this->get_lockout_info($lockout_data);
+      $lockout_data = $this->get_lockout_info($lockout_data);
       
       $captcha_good = false;
       if ( $lockout_data['lockout_policy'] == 'captcha' && $captcha_hash && $captcha_code )
@@ -1030,8 +1030,8 @@
       $ipaddr = $db->escape($_SERVER['REMOTE_ADDR']);
       $timestamp_cutoff = time() - $duration;
       $q = $this->sql('SELECT timestamp FROM ' . table_prefix . 'lockout WHERE timestamp > ' . $timestamp_cutoff . ' AND ipaddr = \'' . $ipaddr . '\' ORDER BY timestamp DESC;');
-      $fails = $db->numrows();
-      $row = $db->fetchrow();
+      $fails = $db->numrows($q);
+      $row = $db->fetchrow($q);
       $locked_out = ( $fails >= $threshold );
       $lockdata = array(
           'locked_out' => $locked_out,
@@ -1045,7 +1045,20 @@
         );
       $db->free_result();
     }
-    return $locked_out;
+    else
+    {
+      $lockdata = array(
+        'locked_out' => false,
+        'lockout_threshold' => $threshold,
+        'lockout_duration' => ( $duration / 60 ),
+        'lockout_fails' => 0,
+        'lockout_policy' => $policy,
+        'lockout_last_time' => 0,
+        'time_rem' => 0,
+        'captcha' => ''
+      );
+    }
+    return $lockdata;
   }
   
   /**