gusl: (Default)
[personal profile] gusl
< ? 
#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-13 09:23 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
And for those IPs that find my site without such an identifying link, and visit a lot, I want to make a message like:

hey, you seem to visit my site quite a lot. I'm now curious about who you are. What's your name?

-Gustavo


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)
From: [identity profile] peamasii.livejournal.com
It might be better to do all this with a site registration mechanism. That way you can identify visitors with a cookie, regardless what their IP is.

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags