+ Reply to Thread
Results 1 to 8 of 8

Thread: To Get And Show The IP via Javascript

  1. #1
    Jesse's Avatar
    Jesse is offline Lord Of The Keys Jesse is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    Manila, PH
    Posts
    1,357

    To Get And Show The IP via Javascript

    To Get And Show The IP via Javascript

    To show the IP via JavaScript


    var ip= '<!--#echo var="REMOTE_ADDR"-->';
    document.write("Your IP Address is :"+ip+" ");
    _______________________________________________

    To show IP via ASP


    request.ServerVariables("REMOTE_ADDR")
    ____________________________________
    TO SHOW IP VIA PHP

    Code:
    <?
    $remote_address = getenv("REMOTE_ADDR");
    echo "Your IP address is $remote_address.";
    $browser_type = getenv("HTTP_USER_AGENT");
    echo "You are using $browser_type.";
    ?>
    x10HOSTING
    Member Since October 2007.

    JESSEMAN.ME
    | iMusicz.net

  2. #2
    apoorav's Avatar
    apoorav is offline x10 Sophmore apoorav is an unknown quantity at this point
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    110

    Re: To Get And Show The IP via Javascript

    Use Sites like http://www.findmyipaddress.info/
    to find real ip address. Dont use JAVASCRIPT.

    My Site: http://www.techfun.exofire.net/

  3. #3
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: To Get And Show The IP via Javascript

    Quote Originally Posted by apoorav View Post
    Dont use JAVASCRIPT
    i don't get why not to use JS to find the ip address, I believe it is as good as using anything else to find the ip; ie PHP.

  4. #4
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: To Get And Show The IP via Javascript

    yeah...i don't think apoorav understands anything (lol)

    :P

    Great tut, i only knew the PHP version.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  5. #5
    kkenny's Avatar
    kkenny is offline Lord Of The Keys kkenny is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    I REP THE BAY. (Bay Area, CA, USA)
    Posts
    1,950

    Re: To Get And Show The IP via Javascript

    Is getting the IP via Javascript just as effective as getting it via PHP or any other scripting language?
    kkenny - retired.
    -Became a Moderator/Staff Member on 4/23/08
    -Became Senior Mod on 8/28/08
    -Became Account Manager on 10/18/08
    -Left Staff and X10 in 2009.


  6. #6
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: To Get And Show The IP via Javascript

    No, it is not, since the user can turn off javascript, plus, the only to store an IP found with JS is to use AJAX or submit a form. It is way more easier and faster to use a server-side method.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  7. #7
    gptsven is offline x10 Lieutenant gptsven is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    253

    Re: To Get And Show The IP via Javascript

    why all the hussle?

    php code to print IP:

    PHP Code:
    <?php
    $vistor_ip 
    $_SERVER['REMOTE_ADDR'];
    echo 
    "your IP-address is :" $visitor_ip;
    ?>

  8. #8
    GTKILLA is offline x10 Sophmore GTKILLA is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    142

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers