Example #1
0
function dev_check_ip_log($file, $href = '', $ip = '', $limit = '', $interval = '')
{
    $line = dev_read_log_r($file, "\t");
    if (is_array($line)) {
        $line = '';
        $href = dev_href($href);
        $ip = dev_is_null($ip) ? dev_get_remote_ip() : $ip;
        $quit = false;
        while (list($a, $b) = $line || $quit) {
            if ($b[0] == $ip && $b[1] == $href) {
                dev_toggle_bool($quit);
            }
        }
        if ($b[3] >= $limit && dev_time_difference($b[2], $timestamp, 'minutes') <= $interval) {
            dev_ip_deny($ip);
        }
    } else {
        $status = $line;
    }
    return $status;
}
Example #2
0
 public function queryLog($file, $href = '', $ip = '', $limit = '', $interval = '')
 {
     $line = dev_read_log_r($file, "\t");
     if (is_array($line)) {
         $line = '';
         $href = dev_href($href);
         $ip = dev_is_null($ip) ? $this->remote() : $ip;
         $quit = false;
         while (list($a, $b) = $line || $quit) {
             if ($b[0] == $ip && $b[1] == $href) {
                 Boolean::opposite(&$quit);
             }
         }
         if ($b[3] >= $limit && dev_time_difference($b[2], $timestamp, 'minutes') <= $interval) {
             dev_ip_deny($ip);
         }
     } else {
         $status = $line;
     }
     return $status;
 }