Results 1 to 3 of 3
Thread: Showing IP# on a web page
-
04-26-2004, 02:40 PM #1WHT Addict
- Join Date
- Mar 2002
- Posts
- 156
Showing IP# on a web page
How do you show the visitor's IP# or remote host information on a web page? I'd like to have this shown on my feedback form page (so the visitor can see his/her IP#) and have this sent out via email to me.
I see these on many sites, but never figured out how."It does not matter how slowly you go, so long as you do not stop." – Confucius
-
04-26-2004, 02:44 PM #2Junior Guru
- Join Date
- Aug 2002
- Posts
- 183
In php, you can do it in the following ways :
Code:<?php echo "Remote Address: ", $_SERVER['REMOTE_ADDR']; // displays the remote ip address. echo "<br />"; // html tag break line which is included inside the php code. echo "Server Address: ", $_SERVER['SERVER_ADDR']; // displays the server ip address. ?> <?php echo "Remote Address: ", getenv("REMOTE_ADDR"); // displays the remote ip address. echo "<br />"; // html tag break line which is included inside the php code. echo "Server Address: ", $serverip = getenv("SERVER_ADDR"); // displays the server ip address. ?> <?php echo "Remote Address: ", $_SERVER['REMOTE_ADDR']; // displays the remote ip address. echo "<br />"; // html tag break line which is included inside the php code. echo "Server Address: ", $_SERVER['SERVER_ADDR']; // displays the server ip address. ?> <?php echo "Remote Address: ", getenv("REMOTE_ADDR"); // displays the remote ip address. echo "<br />"; // html tag break line which is included inside the php code. echo "Server Address: ", $serverip = getenv("SERVER_ADDR"); // displays the server ip address. ?>
-
04-29-2004, 01:19 AM #3Web Hosting Master
- Join Date
- Feb 2004
- Posts
- 772
Hi,
Using PHP you can display IP (REMOTE_ADDR).
<?
$hst = $_SERVER["HTTP_HOST"];
$uri = $_SERVER["REQUEST_URI"];
$rmt = $_SERVER["REMOTE_ADDR"];
$br = $_SERVER["HTTP_USER_AGENT"];
echo "Your IP address reflects as : $rmt \n<br>\n The page you requested was: $uri \n<br>\n The browser you are using is $br";
?>
Regards,
Bright
24 /7 Technical SupportBright Info Solutions