1. Computing

Discuss in my forum

Detect a User's IP Address

How to detect a user's IP address using PHP code

By , About.com Guide

An IP address can tell you a lot about a user, such as the general area from which they are visiting your site. This can help you specialize the site's content for your users, or redirect them based on location. You can also use a person's IP address as a security measure to make sure it is actually them logging into their account. You could also use it to check your own IP address to know if a proxy server is working.

 <?php 
 $ip=$_SERVER['REMOTE_ADDR'];
 echo "Your IP Address is $ip"; 
 ?> 

Have something to add? A bit of code? A suggestion of how to use it? View Reader Responses!

Related Video
Import and Export Address Books in Outlook Express
Link a Website to an Email Address in HTML
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Learn PHP
  5. Record a User's IP address - Detect User IP Address

©2013 About.com. All rights reserved.