Exemplo n.º 1
0
 public static function GetFrequencyForIp($ip, $action, $window)
 {
     if (UL_LOG == false) {
         // We don't have the required information
         return false;
     }
     // Get the number of login attempts to an account
     $ip_login_attempts = 0;
     $time_before_window = ulUtils::date_seconds_sub(new DateTime(), $window)->format(UL_DATETIME_FORMAT);
     $stmt = ulPdoDb::Prepare('log', 'SELECT COUNT(*) FROM ul_log WHERE action=? AND timestamp>? AND ip=?');
     if (!ulPdoDb::BindExec($stmt, array(&$ip_login_attempts, 'int'), array(&$action, 'str', &$time_before_window, 'str', &$ip, 'str'))) {
         return false;
     }
     ulPdoDb::Fetch($stmt);
     return $ip_login_attempts;
 }