Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2003
    Location
    Angier, NC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Showing Server IP address

    I am working on a new hobby site, and I would like to have it show (at the top) (persons_username)@(server_ip_address). Where the respective blanks are filled in with the respective entries based on the person who is at the site and the current IP of the server. Is there any way that I could have PHP display the server's IP address? Thanks in advance for anyone who reads this.
    No matter what happens, someone will find a way to take it too seriously -- Joe Davy

    www.axiscreations.com

  • #2
    New Coder
    Join Date
    Nov 2003
    Location
    PHP-LAND
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <?
    $servername=gethostbyaddr($yourIP);
    ?>

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,058
    Thanks
    10
    Thanked 96 Times in 94 Posts
    <?php echo $_SERVER['REMOTE_ADDR'];?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    are you wanting the IP of the visitor or, as you said, the server?

    for the server you can use $_SERVER['SERVER_ADDR'] or firepage's code form above for the visitor's IP
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,058
    Thanks
    10
    Thanked 96 Times in 94 Posts
    doh sorry , I just assumed Visitor IP , I must be getting old
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #6
    New Coder
    Join Date
    Jul 2003
    Location
    Angier, NC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks everybody! this is my favorite forum!
    No matter what happens, someone will find a way to take it too seriously -- Joe Davy

    www.axiscreations.com


  •  

    Posting Permissions

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