PHP Code:
<?php
$image = "pizza.gif"; ///you need to upload your own gif image
$use_htmlog = 0;
$htmlfile = "baby.htm";
$use_mail = 1;
$your_email = "youremail-CHANGE-this-to-youremail";
$ip=getenv("REMOTE_ADDR");
$hostname = gethostbyaddr($ip);
$httpagent=getenv("HTTP_USER_AGENT");
$httprefer=getenv("HTTP_REFERER");
$date = date("D, m-d-y");
$time = date("g:i A");
$name = "baby";
$email = "freakin@visitor.com";
$subject = "visitor logged ".$ip." - ".$hostname." - agent: ".$httpagent." - refer: ".$httprefer;
$message = "\nvisitor logged: ".$ip." - ".$hostname."\nagent: ".$httpagent."\nrefer: ".$httprefer."\n\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Mailer: fudge you Emailer\n";
$headers .= "From: \"".$name."\" <".$email.">\n";
if($use_mail) {
mail($your_email,$subject,$message,$headers);
}
if($use_htmlog) {
$logfile = fopen($htmlfile, "a");
fputs($logfile, "<b>IP: </b>$ip ($hostname) - <b>INFO: </b>$httpagent on $date at $time - <b>from: </b> $httprefer <br>\n\n");
fclose($logfile);
}
if(!file_exists($image)) {
die("No image");
}
function LoadGif($imgname)
{
$im = @imagecreatefromgif($imgname);
if(!$im)
{
$im = imagecreatetruecolor (150, 30);
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
imagestring ($im, 1, 5, 5, 'Error', $tc);
}
return $im;
}
Header("Content-type: image/gif");
Header("Cache-control: no-cache");
Header("Pragma: no-cache");
Header("Last-modified: ".gmdate("D M d h:i:s Y",time())." GMT");
Header("Expires: ".gmdate("D M d h:i:s Y",time()+1)." GMT");
$img = LoadGif($image);
imagegif($img);
imagedestroy($img);
?>