Looking for a script.

Status
Not open for further replies.

U.n.c.u.T.!

Baseband Member
Messages
26
Hello all,

I'm looking for a PHP script that can detect IP, host, and name, if possible, and write it to a .txt or .log file. If you know of something, please tell.

Uncut
 
Here's something simple
make sure to create a data.log file on your webserver and chmod it to something like 666 to give sufficient privlages to write to the file....
PHP:
<?php
$this = $HTTP_USER_AGENT;
$that = $REMOTE_ADDR;
$host = gethostbyaddr($that);

$file = "data.log";
$open = fopen($file, a);
fwrite($open, "$this\n$that\n$host\n\n");
fclose($open);
?>
hope this works for you
 
The data.log file will look something like this....

Code:
Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U; ) Gecko/20030131
11.111.11.11 <-- Ip address
11-111-11-11.client.attbi.com <-- Hostname

Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U; ) Gecko/20030131
11.111.11.11
11-111-11-11.client.attbi.com

on a side note, this log will go everytime the page is loaded, it doesn't check unique visitors. If you wanted something like that you could dump most of that into a SQL database...that would be a more involved script though ;) Good luck...

~Shan
 
you might know this already but just for the hell of it...don't forget to

PHP:
<? include 'filename.php' ?>
 
Status
Not open for further replies.
Back
Top Bottom