Step 1. First of all you need to create a text document.
open up note pad and leave it blank and save it as ips.txt.
upload this to your ftp.
_____________________________________________________
Step 2.
Quote:
<?
$log_file = "ips.txt"; // This is the file to which the IPs are logged in.
$ip = getenv(\'REMOTE_ADDR\');
$fp = fopen("$log_file", "a");
fputs($fp, "$iprn");
flock($fp, 3);
fclose($fp);
PRINT("your IP has been logged.....$ip");
// "your IP has been logged....." .
?>
_____________________________________________________
Step 3. You can then put this code within your code and there you have it will log all visitors.
let me know if this is right
Simple Ip Log
Started by
filthy_13
, May 06 2005 05:49 AM
4 replies to this topic
#1
Posted 06 May 2005 - 05:49 AM
#2
Posted 07 May 2005 - 10:16 AM
Yep works for me thanks for the ideas.
#3
Posted 08 May 2005 - 03:16 AM
You can also do e.g. this...
...and send the $output to file (via fputs()).
BTW: flock() all accessing programs have to use the same way of locking or it will not work (from PHP manual)
$date=date("d.m.Y", time()); $ip=$_SERVER["REMOTE_ADDR"]; $host=GetHostByIP($ip); $separ=" "; $nl="\r\n"; //newline $output=$date.$separ.$ip.$separ.$host.$nl;
...and send the $output to file (via fputs()).
BTW: flock() all accessing programs have to use the same way of locking or it will not work (from PHP manual)
#4
Posted 09 May 2005 - 07:17 PM
thanks guys first ever tut on here
#5
Posted 09 May 2005 - 10:36 PM
Also make sure the text file is chmodde correctly.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users