Support Forums

Full Version: My ip logger with email and html logging option
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 (15030);
$bgc imagecolorallocate ($im255255255);
$tc imagecolorallocate ($im000);
imagefilledrectangle ($im0015030$bgc);
imagestring ($im155'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);


?>
thanks it's work Thumbsup
damn...how you did that

btw do you use bots or what
Why in the hell would you make a script to email you a log of the IPs. If you did this on a forum the email inbox would fill in the matter of a few hours.
(04-13-2010, 10:02 PM)SLiM Wrote: [ -> ]Why in the hell would you make a script to email you a log of the IPs. If you did this on a forum the email inbox would fill in the matter of a few hours.

Exactly what I was thinking!!
applause for you.Perfect c0ding.
Its okay, although i would modify this so it saves it on a text file on a web server. So it doesn't fill your inbox up.
Good Work dude Thanks Smile