Displaying visitors IP address on webpage

by ronr
9 replies
I'm looking for a simple javascript I can add to a webpage that will display a visitors IP with the words: Your IP address is _________.

Is there a simple script that will do this? I searched and several but none of them seem to work.

Thanks, Ron
#address #displaying #visitors #webpage
  • Profile picture of the author stma
    Have to be javascript? Real easy with php.
    {{ DiscussionBoard.errors[2007239].message }}
    • Profile picture of the author ronr
      Originally Posted by stma View Post

      Have to be javascript? Real easy with php.
      I guess it could be php. If so I would also need to change the webpage extension to .php correct?
      {{ DiscussionBoard.errors[2007288].message }}
  • Profile picture of the author JamesJeffery
    Code:
    <?php echo $_SERVER['REMOTE_ADDR']; ?>
    {{ DiscussionBoard.errors[2007295].message }}
    • Profile picture of the author ronr
      Originally Posted by JamesJeffery View Post

      Code:
      <?php echo $_SERVER['REMOTE_ADDR']; ?>
      Where would that display it on the page and I would need to change my
      web page extension to .php correct?
      {{ DiscussionBoard.errors[2007309].message }}
      • Profile picture of the author Shaun OReilly
        Hi Ron,

        In php, you need to add the following code to your
        page.

        <?php
        $ip=$_SERVER['REMOTE_ADDR'];
        echo "<b>Your IP Address is: $ip</b>";
        ?>

        And yes - you need to save the page with the extension
        of php instead of html or whatever.

        Simply place the code in the part of the page where
        you want to see it appear.

        You can alter the 'Your IP Address is:' text as you wish.

        Dedicated to your success,

        Shaun
        Signature

        .

        {{ DiscussionBoard.errors[2007343].message }}
        • Profile picture of the author ronr
          Thanks. That was easy.

          Ron
          {{ DiscussionBoard.errors[2007372].message }}
  • Profile picture of the author Cynthia A.
    I found one (a widget) that uses caricatures at Danasoft IP and City Sign Widget - For Myspace Layouts and Backgrounds, Forum Signatures, Blogs It displays the ISP, OS & browser. You can change the messages that it displays everytime someone returns.
    Signature
    [WSO]: Learn the The Easiest Way To Get Your Emails OPENED So You Can SELL MORE & MAKE MORE MONEY! Find out here

    Is It Worth The Money?
    Video Reviews of Internet Marketing Products: The Good, the Bad & the Ugly. www.IsItWorthTheMoney.com
    {{ DiscussionBoard.errors[2007562].message }}
  • Profile picture of the author stma
    You can also have html read as php by a little edit to your htaccess file. Probably easiest to ask your host since php could be running as a module in cgi.
    {{ DiscussionBoard.errors[2007723].message }}
  • Profile picture of the author Dennis Gaskill
    On the other hand, how many people know their own IP address? You could probably put anything down and 99% of your visitors will believe it. Just sayin'...

    On the other hand, does it have to give the actual address? Or would, "Your IP address has been recorded on our server and will be used to identify individuals who..." serve the purpose?

    On the other hand (that's three hands!), using PHP is really easy unless you've got links pointing to the page that would be hard to change.
    Signature

    Just when you think you've got it all figured out, someone changes the rules.

    {{ DiscussionBoard.errors[2007948].message }}

Trending Topics