SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

PHP script to Find out IP address

We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor can be done this way. Some time based on the IP address we can redirect the browser to different areas of the site. There are many applications using this and here is the PHP code to know the IP address of any visitor to the site.

$ip=@$REMOTE_ADDR;
echo "<font face='Verdana' size='3'><b>IP Address= $ip</b>";



This is the code and here is your IP address= 38.103.63.18

IP address if the register_global is off
If at php.ini if register_global is set to Off then we have to change the script a bit to get the address. Here it is

$ip=$_SERVER['REMOTE_ADDR'];


You can see the modification done to signup & login script if global variable is OFF

Same way you can find out the referrer to your site by using PHP. Click here to know the Referrer by using PHP.

Related Tutorial
Conditional Redirect
PHP Login script
PHP file upload
PHP paging
PHP drop down list


How to get IP address in ASP ?

Read article on visitor tracking




Discuss this tutorial at forum


Further readings
Getting IP address of visitors
Collecting visitor referrer
Logging Visitor details to MySQL details
Getting details of Visitors
 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorial Index
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
PHP Tutorials
Date & Time
Array
String Functions
Math Functions
Form Handling
File Handling
Comment Posting
Content Management
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.