PDA

View Full Version : Ip



alex126
05-09-2005, 11:06 AM
How do I log Ip's coming on to my site???





alex126

Mentor
05-09-2005, 11:09 AM
that should all be in your raw access logs anyway, but if u have php a logger system would be pretty simple, just get the ip, and append a flat file with what ever one it detects every page activation

alex126
05-09-2005, 11:14 AM
that should all be in your raw access logs anyway, but if u have php a logger system would be pretty simple, just get the ip, and append a flat file with what ever one it detects every page activation


oky dockey. Hotscripts it is

Mentor
05-09-2005, 11:26 AM
=.=
ok ok, heres a basic script to do it, just ads each ip to a new line, thats all it does thogh so if u wanted other stats with it youd have to ask


<?php
//file (chmod it to 777)
$file = "ips.txt";
// get ip
$userip = $_SERVER['REMOTE_ADDR'];
// write ip data to file
$fp = fopen($file, "a") or die( "Error" );
fputs($fp, "$userip \n");e
fclose($fp);
?>

alex126
05-09-2005, 11:31 AM
=.=
ok ok, heres a basic script to do it, just ads each ip to a new line, thats all it does thogh so if u wanted other stats with it youd have to ask


<?php
//file (chmod it to 777)
$file = "ips.txt";
// get ip
$userip = $_SERVER['REMOTE_ADDR'];
// write ip data to file
$fp = fopen($file, "a") or die( "Error" );
fputs($fp, "$userip \n");e
fclose($fp);
?>



So do I put this on the page of my site???

Mentor
05-09-2005, 11:37 AM
yup, as long as your host suppoorts php, and the page type is php it will work.
athogh rember to create the file ips.txt and chmod it to 777

alex126
05-09-2005, 11:40 AM
yup, as long as your host suppoorts php, and the page type is php it will work.
athogh rember to create the file ips.txt and chmod it to 777


Dam It wont work I keep on getting interneal server error and stuff

Mentor
05-09-2005, 11:42 AM
i just noticed a roag letter that shoulnt be try this.


<?php
//file (chmod it to 777)
$file = "ips.txt";
// get ip
$userip = $_SERVER['REMOTE_ADDR'];
// write ip data to file
$fp = fopen($file, "a") or die( "Error" );
fputs($fp, "$userip \n");
fclose($fp);
?>

alex126
05-09-2005, 11:47 AM
Edit: its working now


+rep

Want to hide these adverts? Register an account for free!