View Single Post
Old 04-09-2009, 07:51 PM   #6 (permalink)
Sakakuchi
The Contributor
 
Sakakuchi's Avatar
 
Join Date: Feb 2009
Posts: 64
Thanks: 1
Sakakuchi is on a distinguished road
Default

Wrote this some time ago - makes actually the same - (But looks quite messy...)

PHP Code:
    public function protectBruteforce()
  {
        
$ip $this->getUserIP();
        
$core = new core;
        
$query sprintf("SELECT * FROM log_failed_login WHERE IP = '%s' AND `time` > '%s' LIMIT 0,7",
        
$core->cleanSQL($ip), time() - 600);
        
$result mysql_query($query) or die('Could not perform query.');
        if(
mysql_num_rows($result) > 6)
    {
            die(
'loginLimitExceeded');
        }
        
mysql_free_result($result);
    } 
Sakakuchi is offline  
Reply With Quote