Title: how to display ip address php script code function from visitor user
Description: how to display ip address php script code function from visitor user PHP
Tags: how, to, display, ip, address, php, script, code, function, from, visitor, user
Info: This Post Has Been Viewed 36078 Times SinceWed Sep 13, 2006 4:56 pm Author hostman With 35 Replies #399

how to display ip address php script code function from visitor user

YOUR IP ADDRESS IS: 38.107.179.210


In order to maintain security to your website, its important to know who is visiting your website. One way is to get the user's IP Address.
This is the PHP Function to display your visitor's IP Address:

First, its important that you have php. If you don't have php, we recommend you buy a php plan from our friends at www.webune.com they have great PHP hosting plans for your domain name or website.

Ok, that's all you need - PHP hosting. Once you know you have php, you can continue, otherwise, if you don't, this script will not work unless the script is parsed by PHP engine.

1. the first step in this tutorial guide is to copy and past the sample code below to your favorite editor, I will be using notepad.exe in Windows for this simple tutorial. So, copy and paste this code:

<h1>Show My Ip Address Script</h1><hr> By <strong>Wallpaperama.com</strong><br><br> Your Ip Address is: <strong><?php echo $_SERVER['REMOTE_ADDR']; ?></strong><br><br> Cool! - See how simple it is to get and display the ip address of your visitors to your site. We hope you learned from this show tutorial on how to display your ip address using php<br> <br> If you want to see more helpful scripts for your website, <a href="http://www.wallpaperama.com">Click Here to See More Helpful Scripts &gt;&gt;&gt;&gt;&gt;</a>

2. Now save this file as "show-ip.php", if you are using notepad, make sure to put the quotes ( " ) when Saving As

3. Now upload the show-ip.php file to your hosting space on your website which has PHP.

our friends at www.webune.com have provided us with PHP hosting to bring you a demo of this script.

IF you found this tutorial helpful, we would appreciate a word of mouth to your friends about wallpaperama or link back to wallpaperama.com

Comments (35)
View Top Comments
Leave Your Comments...
#1
1
komal:
2 months ago
#177239
komal Mon Feb 27, 2012 5:34 pm
Thanks wallpaperama...
#2
snehal:
3 months ago
#175821
snehal Wed Feb 08, 2012 9:35 pm
how to get different machine address shared on same network using php code
#3
yogesh:
4 months ago
#172215
yogesh Tue Dec 20, 2011 9:00 pm
20-399-13082011171.jpg
thank god i have found this code on this wesite.........
#4
Ankit:
6 months ago
#169644
Ankit Tue Nov 08, 2011 3:29 am
Thanks, i got after so many searches on google
#5
Neha:
8 months ago
#166679
Neha Wed Sep 14, 2011 11:38 pm
thank for this script ^_^
#6
Taukir:
9 months ago
#164459
Taukir Sun Aug 14, 2011 5:17 am
I want to write code for my webpage with which only those user can veiw who belongs to my domain....
#7
vivek:
1 year ago
#156125
vivek Thu Apr 28, 2011 11:30 am
hey .. this is very nice post
#8
anna:
1 year ago
#155412
anna Wed Apr 13, 2011 4:09 am
<?php
//Gets the IP address
$ip = getenv("REMOTE_ADDR") ;
Echo "Your IP is " . $ip;

$ip1 = $_SERVER["REMOTE_ADDR"];
Echo "Your IP is " . $ip1;

$ip2 = $_SERVER["REMOTE_PORT"];
Echo "Your IP is " . $ip2;

$ip3 = $_SERVER["GATEWAY_INTERFA Echo "Your IP is " . $ip3;

$ip3 = $_SERVER["SERVER_ADDR"];
Echo "Your IP is " . $ip3;

$ip4 = $_SERVER["SERVER_NAME"];
Echo "Your IP is " . $ip4;

$ip5 = $_SERVER["SERVER_SOFTWARE Echo "Your IP is " . $ip5;

$ip6 = $_SERVER["SERVER_PROTOCOL Echo "Your IP is " . $ip6;

$ip7 = $_SERVER["REQUEST_METHOD" Echo "Your IP is " . $ip7;

$ip8 = $_SERVER["REQUEST_TIME"]; Echo "Your IP is " . $ip8;

$ip9 = $_SERVER["QUERY_STRING"]; Echo "Your IP is " . $ip9;

$ip9 = $_SERVER["HTTP_CONNECTION Echo "Your IP is " . $ip9;

$ip10 = $_SERVER["HTTP_HOST"];
Echo "Your IP is " . $ip10;

$ip11 = $_SERVER["REMOTE_ADDR"];
Echo "Your IP is " . $ip11;

$ip12 = $_SERVER["REMOTE_HOST"];
Echo "Your IP is " . $ip12;
?>

for more info visit my site
#9
Bob:
1 year ago
#145686
Bob Fri Oct 01, 2010 1:45 pm
this was great... thanks is there any additional info we can provide our visitors using similar code?

the page that I was referring to was: wallpaperama.c
#10
amand:
1 year ago
#144871
amand Wed Sep 22, 2010 3:23 am
grate job go a head .thank you for coding
gccccccccccccccccc
#11
haCk_world.exe:
1 year ago
#141390
haCk_world.exe Sun Aug 08, 2010 10:36 am
hey.... i want to maintain IP address log.. of my blog visiting. so... i've done some modification to the code...

The .php file is at
ripway dot com site..
(e.g. URL = h1.ripway dot com /xyz/ made free domain in .co.cc
(e.g. xyz.co.cc)
which is set to redirect us to .php file
(at h1.ripway dot com /xyz/ = $_SERVER['REMOTE_ADDR'] ;
$file=fopen("log.txt"," $ip);
fclose($file);
head 'Location: xyz.blogspot dot com ' ) ;
?>

output in log.txt file
==================== the question is,.. why i'm not getting the real ip address of the client (e.g 113.124.122.10)
always i'm getting 192.168.0.6)

plz... help me...

#12
saurabh:
1 year ago
#140651
saurabh Sat Jul 31, 2010 4:29 am
31-399-logo.jpg
code result is Your Ip Address is: ::1


but i want to full address like you.
#13
Owen:
2 years ago
#132674
Owen Fri Apr 30, 2010 3:36 am
Q. What happens when a brother and a sister breed?

A. You get 'rofllllllll'!
#14
1
xyz:
2 years ago
#130174
xyz Fri Mar 19, 2010 4:04 am
<h1>Show My Ip Address Script</h1><hr> By <strong>Wallpaperama dot com < Your Ip Address is: <strong><?php echo $_SERVER['REMOTE_ADDR']; ?></strong><br><br> Cool! - See how simple it is to get and display the ip address of your visitors to your site. We hope you learned from this show tutorial on how to display your ip address using php<br> <br> If you want to see more helpful scripts for your website, <a href="wallpape Here to See More Helpful Scripts &gt;&gt;&gt;&gt;&gt;</a>
#15
Jim:
2 years ago
#126974
Jim Fri Jan 29, 2010 1:34 pm
One line snippet can be added anywhere you want visitor's IP Address to show at aofra dot com Works every time.
#16
1
exe:
2 years ago
#126317
exe Wed Jan 20, 2010 2:56 am
<?php echo $_SERVER['REMOTE_ADDR']; ?>

this does their thing without shameless plugging of affiliates
#17
qadeee:
2 years ago
#121370
qadeee Mon Nov 23, 2009 9:25 pm
first, its important that you have php. if you don't have php, we recommend you buy a php plan from our friends at webune they have great php hosting plans for your domain name or website.
#18
Chickenmobile:
2 years ago
#112652
Chickenmobile Fri Aug 14, 2009 1:57 am
i wondered why it was so hard to figure out how to obtain an ip adress while it is on a lot of webpages, the propblem is that php code doesnt atually show up in the source html code.

good thing that i have php :d.
#19
Michael:
2 years ago
#110546
Michael Sat Jul 25, 2009 11:40 am
this sucks camel dicks
#20
lol:
2 years ago
#109088
lol Sun Jul 12, 2009 5:39 am
<?php echo"hiiiii"; ?>
Leave Your Comments...
Pages: 12
Share
| More