Php

Talk about anything to do with making sites or running Servers.
Post Reply
Char
noob
Posts: 28
Joined: Fri Jul 22, 2005 7:54 pm

Post by Char »

i am learning php
i have a problem...well how can i save people's IP adress?
i put this to my site and then it will print he's ip when he goes to my homepage

Code: Select all

<?php
echo $_SERVER["REMOTE_ADDR"];
?>
i basicly want that it would write people's ip to a text file who have had visited my homepage :)
juggalo2
Spamtastic
Posts: 1144
Joined: Sun Jul 17, 2005 5:28 pm

Post by juggalo2 »

<?
$log_file = "log.txt";
$ip = $REMOTE_ADDR;
$page = $_SERVER['REQUEST_URI'];
$host = gethostbyaddr($REMOTE_ADDR);
$date_time = date('d-m-Y/H:i:s');
$fp = fopen("$log_file", "a");
fputs ($fp,"
($date_time) $ip ($host) $page
");
flock($fp, 3);
fclose($fp);
?>


THERE YOU GO SOUDL WORK FINE
<img src='http://lifeplaysu420.com/unknow/nightsign.png' border='0' alt='user posted image' /><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Wanna make money for surfing the net sing up at <br><a href='http://www.cashfiesta.com/php/join.php? ... yprivitera' target='_blank'>cash fiesta</a><br>its all free hey why ntot make money while fucking around on the computer<br><br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Post Reply