Help on IP [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LmS
Forum Newbie
Posts: 4
Joined: Sat Oct 08, 2005 5:51 am

Help on IP [SOLVED]

Post 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,
Last edited by LmS on Sat Oct 08, 2005 7:23 am, edited 1 time in total.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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 ;)
LmS
Forum Newbie
Posts: 4
Joined: Sat Oct 08, 2005 5:51 am

Post 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.
Post Reply