Scriptplayground Network

Scriptplayground Preview
Fireworks CS4 Learning Center

Flash and PHP Bible

The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area. This book explains the process of working with PHP in Flash, while creating real world examples that you can actually learn something from.

The Flash and PHP Bible has a dedicated forum for support and comments.

Scriptplayground » tutorials » php » Show Users IP

Show Users IP

Here is a simple tutorial to display the visitors IP. You can also capture the IP and use it in other parts of your code.

<?php
$user_ip = $SERVER['REMOTE_ADDR'];
print "Your IP Address is " . $user_ip;
?>

The above lines of code grab the users IP address and display it. That is all there is to grabbing the users IP.

Comments: Show Users IP

 Jesse  Sat Dec 3, 2005 7:46 am  
Thanks, this is usefull :)
 Callum  Wed May 2, 2007 1:41 pm  
This script is avalible everywhere but still its extemely useful. Thanks!
 Joe  Sat Aug 18, 2007 8:47 am  
Where is the IP displayed?
 Colin  Wed Dec 19, 2007 3:39 pm  
@Joe:
print "Your IP Address is " . $user_ip;
Where it says $user_ip that shows them it.
Add a comment
Name:
Website:
Comment:
Please note: Offensive comments, flaming and spamming is not permitted on this site and your comment will be deleted immediately.

HTML is not allowed.

Please provide all comments in English so that others can help you. A common helper in this is to use an online translator.

As a security measure your ip will be recorded.
 
Anti-Robot Check:

Enter the key you see above.

What is this?: This extra test has been added due to the recent explosion of spam.
 
Google