#! /usr/bin/php open_log_file($log)) { while ($line = $logparser->get_line()) { if (strpos($line, "GET /robots.txt HTTP/") !== false) { $parts = $logparser->format_line($line); $_SERVER['HTTP_USER_AGENT'] = $parts['agent']; if (!is_spider()) $notfound[] = $parts['agent']; } } $logparser->close_log_file(); } else { echo "Cannot open $log\n"; exit(1); } if (count($notfound)) { $header[] = 'From: Zeitungsliste '; $header[] = 'To: Joey Schulze '; $header[] = 'MIME-Version: 1.0'; $header[] = 'Content-type: text/plain; charset=utf-8'; $header[] = 'Content-Disposition: inline'; $header[] = 'Content-Transfer-Encoding: 8bit'; $to = 'joey@infodrom.org'; $subject = 'Spider nicht erkannt'; $body = "Die folgenden Spider wurden nicht anhand ihres UserAgent-Kennung\n". "erkannt:\n\n"; foreach ($notfound as $agent) $body .= " " . $agent . "\n"; mail ($to, $subject, $body, implode("\n", $header)); } ?>