bot-logger-special

Gesponsorde koppelingen

PHP script bestanden

  1. bot-logger-special

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
 $bot
[0] = "MSN";
$bots[0] = "MSNBOT/0.1 (http://search.msn.com/msnbot.htm)";
 $bot[1] = "google";
$bots[1] = "Googlebot/2.X (+http://www.googlebot.com/bot.html)";
// See http://www.robotstxt.org/wc/active/html/type.html for more Bots
$method = "log"; //mail or log
  //If     LOG

 $logfile="log.txt";
  //If     Mail
 $mail  = "[email protected]";
 
 $totalbots=count($bot) - 1;
for($i = 0;$i <= $totalbots;$i++){
    if (eregi($bot[$i], $_SERVER['HTTP_USER_AGENT'])){
            $onderwerp = $bot[$i]." Bezocht Uw Site.";
             $msg = ucfirst($bot[$i])." heeft jou website bezocht!\n\n";      
             $msg .= "Bezocht op: " . date("d.m.Y H:i") . "\n\n";          
             $msg .= "Ip adres: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $msg .= "Hostname: " . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n";
             $msg .= "LongName: " . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
            
        if($method=="log"){
             $msg .="--------------------------------------------------------------\n\n";
             $file = fopen($logfile,"a");
             $filec = fwrite($file,$msg);
             fclose($file);
            
            if(!$filec){
                $mailc = mail($mail, $onderwerp, $msg, "From: [email protected]");
            }
        }
elseif($method=="mail"){
            $mailc = mail($mail, $onderwerp, $msg, "From: [email protected]");
            if($mailc == ""){
                 $msg .="--------------------------------------------------------------\n\n";
                $file = fopen($logfile,"a");
                fwrite($file,$msg);
                fclose($file);
            }
        }
    }
}

?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.