-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
48 lines (27 loc) · 1.27 KB
/
index.php
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
44
45
46
47
48
<?php
// replace the following variable with your email
$youremail ="[email protected]";
$visitor = "\n referrer:".$_SERVER['HTTP_REFERER'];
$visitor = $visitor. "\n - user agent:".$_SERVER['HTTP_USER_AGENT'];
$visitor = $visitor. "\n - remote add:".$_SERVER['REMOTE_ADDR'];
$visitor = $visitor. "\n - remote host:".$_SERVER['REMOTE_HOST'];
//useless for google, but may still give you some insights for other search engines
$visitor .= "\n"."query string".$_SERVER['QUERY_STRING'] ;
//in order to resolve the IP address i've installed the Maxmid GeoIP module for apache
// http://dev.maxmind.com/geoip/legacy/mod_geoip2/
$visitor .= "\n"."country: ".$_SERVER['GEOIP_COUNTRY_NAME'] ;
$headers .= 'To: '. $youremail . "\r\n";
$headers .= 'From: '. $youremail . "\r\n";
//i was interested in monitoring users from italy and googlebot
//if you want to check other user agents, check this url
// http://www.useragentstring.com/pages/useragentstring.php
if ($_SERVER['GEOIP_COUNTRY_NAME'] !="Italy" &
(strpos($_SERVER['HTTP_USER_AGENT'],"google")==0)) {
$subject= 'user is not italian and is not google';
} else
{
$subject= 'user is google or italian';
}
//you may change the subject [Seoxray] as you prefer
mail ($youremail ,'[Seoxray]'.$subject,'Visitor:'.$visitor, $headers);
?>