The Scarlet Pimp
Supreme Member
- Apr 2, 2008
- 1,416
- 4,457
This is a very simple script that will send you an email every time somebody views the web page it's installed on. The email will show you the exact keywords and search engine the visitor used to find your web page. Plus it will also show you that visitor's IP number.
This script can be helpful if you use Adwords since you'll know which words, phrases, and misspellings are being used. Or you can just add the words to your web page to (hopefully) increase your overall rank.
You'll need to adjust this to show the correct time when the page was viewed. Replace 'xxx' with the time difference between where you are and where the
Server is.
For example, if you live in New York and you host with Lunar Pages you would
replace 'xxx' with the numeral '3' because there's a three hour time difference between NY and California. But if you live in Cali. then you'd use the numeral '0' because you're in the same time zone.
Add your email address and the time difference (if any) and place this at the
bottom of the page. You should also add a filter to your email account so the
messages get filed into their appropriate folders. Otherwise your main email account will get flooded with alert messages!
An easy way to do this is to file the alerts according to message subject,
which you can easily change to anything that you like. If you have any problems, post them here. But this is pretty straight forward so you should
not have any problems.
$recipient = "[email protected]"; Put your email here.
$hourdiff = "XXX"; Enter time difference here.
$subject = "Visitor Alert: Home Page"; Change this as you will.
This script can be helpful if you use Adwords since you'll know which words, phrases, and misspellings are being used. Or you can just add the words to your web page to (hopefully) increase your overall rank.
You'll need to adjust this to show the correct time when the page was viewed. Replace 'xxx' with the time difference between where you are and where the
Server is.
For example, if you live in New York and you host with Lunar Pages you would
replace 'xxx' with the numeral '3' because there's a three hour time difference between NY and California. But if you live in Cali. then you'd use the numeral '0' because you're in the same time zone.
Add your email address and the time difference (if any) and place this at the
bottom of the page. You should also add a filter to your email account so the
messages get filed into their appropriate folders. Otherwise your main email account will get flooded with alert messages!
An easy way to do this is to file the alerts according to message subject,
which you can easily change to anything that you like. If you have any problems, post them here. But this is pretty straight forward so you should
not have any problems.
$recipient = "[email protected]"; Put your email here.
$hourdiff = "XXX"; Enter time difference here.
$subject = "Visitor Alert: Home Page"; Change this as you will.
Code:
<?
$myserver = "http://".$HTTP_HOST.$_SERVER[REQUEST_URI];
$ip = $_SERVER['REMOTE_ADDR'];
$cname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$fullhost = gethostbyaddr($ip);
$host = preg_replace("/^[^.]+./", "*.", $fullhost);
$hourdiff = "XXX";
$timeadjust = ($hourdiff * 60 * 60);
$melbdate = date("D, M. jS, Y [g:i A]",time() + $timeadjust);
$recipient = "[email protected]";
$subject = "Visitor Alert: Home Page";
$message = "--------------------------------<br>
*** SENDER INFO ***
<p>
ISP Address:<br>
<a href='http://ws.arin.net/cgi-bin/whois.pl?queryinput=$_SERVER[REMOTE_ADDR]'>$_SERVER[REMOTE_ADDR]</a>
<p>
ISP Name:<br>
$cname
<p>
Browser Type:<br>
$_SERVER[HTTP_USER_AGENT]
<p>
Page Referer:<br>
<a href=$_SERVER[HTTP_REFERER]>$_SERVER[HTTP_REFERER]</a>
<p>
Page Viewed:<br>
<a href=$myserver>$myserver</a>
<p>
Date and Time Sent:<br>
$melbdate<br>
--------------------------------";
$message = stripslashes($message);
$headers = "From: Alert <[email protected]>\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=ISO-8859-1\r\n";
mail($recipient,$subject,$message,$headers);
?>