Results 1 to 3 of 3
  1. #1

    Question 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

  2. #2
    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. 
    ?>

  3. #3
    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 Support
    Bright Info Solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •