Page 1 of 1

Help on IP [SOLVED]

Posted: Sat Oct 08, 2005 5:57 am
by LmS
Hey all :)
I making just a litle thing aroud ip's in php.

Code: Select all

<?
$ip=@$REMOTE_ADDR; 
echo "<font face='Verdana' size='3'><b>IP Address= $ip</b>";
//Replace the Your IP To the ip you want to allow
if($ip == "Your IP") {
	echo "<BR>";
	echo "Welcome LmS";
} else {
	echo "<BR>";
	echo "Please, go away!";
}
?>
That's the code i'm using. The only thing i wanted is that he display the ip of the user and if the ip match the ip i give up, that he say's welcome LmS. Some how he dont show ip, and allways ay Please, go away!
Can anyone help me ? :oops:

Thnx,

Posted: Sat Oct 08, 2005 6:03 am
by n00b Saibot

Code: Select all

$ip=$_SERVER['REMOTE_ADDR'];
I forewarn you that IPs are highly unreliable and change at a moment's notice so I would suggest relying on uname/pass method instead ;)

Posted: Sat Oct 08, 2005 6:19 am
by LmS
n00b Saibot wrote:

Code: Select all

$ip=$_SERVER['REMOTE_ADDR'];
I forewarn you that IPs are highly unreliable and change at a moment's notice so I would suggest relying on uname/pass method instead ;)
thnx and thnx for the tip m8.