< ?
#header("Content-Type: text/html");
$handleStr = "/home/username/public_html/log.txt";
$handle = fopen($handleStr, "a");
$ip = $_SERVER['REMOTE_ADDR'];
$fullhost = @gethostbyaddr($ip);
#IP address: $_SERVER['REMOTE_ADDR']
#see http://nl3.php.net/reserved.variables
if ($_SERVER['REMOTE_ADDR'] != "121.11.1.11" && $_SERVER['REMOTE_ADDR'] != "212.22.22.212") #ignore my own home hits
{
fwrite($handle, strftime("%d/%b/%Y %I:%M'%S %p") . " ");
fwrite($handle, "page " . $_SERVER['PHP_SELF']);
fwrite($handle, " referrer: " . $_SERVER['HTTP_REFERER']);
fwrite($handle, "\n");
fwrite($handle, "browser=[" . $_SERVER['HTTP_USER_AGENT'] . "]");
fwrite($handle, "\n");
fwrite($handle, "remote_host= \"" . $_SERVER['REMOTE_HOST'] . "\"");
fwrite($handle, " fullhost=" . $fullhost . " (" . $ip . ")\n");
fwrite($handle, "\n");
fwrite($handle, "\n");
}
fclose($handle);
? >
(no subject)
Date: 2005-09-12 10:12 pm (UTC)you can write the if line also as:
if (in_array($_SERVER['REMOTE_ADDR'], array(
"121.11.1.11", "other ip addy"
)) {
which makes it easier to add other ip addresses.
Also, web proxies change REMOTE_ADDR, so you might get skewed results.
(no subject)
Date: 2005-09-13 07:47 am (UTC)(no subject)
Date: 2005-09-13 09:12 am (UTC)One difference, though, is that I'm interested in individual visitors. I'd like to change my signature on every email, in order to see who saw what.
http://www.optimizelife.com/index.php#peamasii130905
Then I can associate the IP with the person, and if they visit again spontaneously, that's probably a sign that they liked my site.
(no subject)
Date: 2005-09-13 09:23 am (UTC)The message is easy to make with PHP, but I think I would need to create a form for them to POST, and that would kinda suck.
A JavaScript pop-up might be nicer, but that doesn't simplify anything.
(no subject)
Date: 2005-09-13 09:29 am (UTC)