Beispiel #1
0
 public function log($file, $href = '', $ip = '')
 {
     if (file_exists($file)) {
         $line = '';
         $href = dev_href($href);
         $ip = dev_is_null($ip) ? $this->remote() : $ip;
         $line = dev_read_log_r($file, "\t");
         if (is_array($line)) {
             $quit = false;
             while (list($a, $b) = $line || $quit) {
                 if ($b[0] == $ip && $b[1] == $href) {
                     Boolean::opposite(&$quit);
                 }
             }
             if (dev_time_difference($b[2], $timestamp, 'minutes') > 5) {
                 $message = "{$ip}\t{$href}\t{$timestamp}\t{$count}\n";
                 $status = dev_create_log($message, $file);
             } else {
                 $line[$a][3]++;
                 $status = dev_write_log_r($file, $line, "\t");
             }
         }
     } else {
         $status = "Failed to open log file. File could not be found.\n";
     }
     return $status;
 }
Beispiel #2
0
function dev_parachute(&$count, $max = '', $redirect = '', $log = false, $alert = false)
{
    $max = dev_not_null($rcpt) ? $max : 400;
    if ($count >= $max) {
        $status = "Loop exceeded max count! Killing Process.\n";
        if ($alert) {
            dev_email_admin_alert($status);
        }
        if ($log) {
            dev_create_log($status);
        }
        if (dev_not_null($redirect)) {
            dev_redirect($redirect, array('msg' => $status));
        } else {
            exit("A script on this page began to loop out of control. Process has been killed. If you are viewing this message, please alert the administrator.\n");
        }
    }
    $count++;
}