Know IP

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
hmsg
Forum Commoner
Posts: 42
Joined: Sun May 14, 2006 9:48 am

Know IP

Post by hmsg »

How can i get the IP of a user that is entering my url?


With the best regards

Hugo Gomes
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

$_SERVER['REMOTE_ADDR'] will contain the remote user's IP address.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

Code: Select all

$ip =$_SERVER['REMOTE_ADDR'];
:P
hmsg
Forum Commoner
Posts: 42
Joined: Sun May 14, 2006 9:48 am

Post by hmsg »

Where i can find all the variables of the $_SERVER ?

All like that one and other like $_SERVER['SSL .....whatever'] all that exists?
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

Code: Select all

echo "<pre>";
print_r($GLOBALS);
echo "</pre>";
or

Code: Select all

echo "<pre>";
print_r($_SERVER);
echo "</pre>";
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply