1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple IP Grabbing Script?

Discussion in 'HTML & JavaScript' started by Zakk-, Jan 7, 2010.

  1. Zakk-

    Zakk- Junior Member

    Joined:
    Sep 16, 2009
    Messages:
    141
    Likes Received:
    15
    Okay, I am sure this is probably pretty easy, but I'm not much of a PHP person myself.

    What I am looking for is a script that will grab the IP of the visitor and print it to a text file. Nothing fancy, just a way to get IP's of a specific person without much effort.


    Anyone help me out? Thanks...
     
  2. petros

    petros Newbie

    Joined:
    Jan 23, 2009
    Messages:
    13
    Likes Received:
    7
    PHP:
    <?php

    $ip 
    $_SERVER['REMOTE_ADDR'];
    $log fopen("log.txt""a+");
    fwrite($log"$ip\r\n");
    fclose($log);

    ?>
     
    • Thanks Thanks x 1
  3. Zakk-

    Zakk- Junior Member

    Joined:
    Sep 16, 2009
    Messages:
    141
    Likes Received:
    15

    Works perfect, thanks.
     
  4. petros

    petros Newbie

    Joined:
    Jan 23, 2009
    Messages:
    13
    Likes Received:
    7
    No problem. Let me know if you need anything else.
     
  5. yuvraj

    yuvraj Regular Member

    Joined:
    Jan 26, 2010
    Messages:
    290
    Likes Received:
    166
    Location:
    Inside
    Thanks petros..