ipchicken clone code

Discussion in 'PHP' started by pein87, Aug 9, 2010.

  1. pein87

    pein87 Active Member

    Joined:
    Aug 6, 2010
    Messages:
    173
    Likes Received:
    47
    Trophy Points:
    28
    Occupation:
    Web Dev
    Location:
    Limbo
    I used this one my personal site but since it mimics ipchicken I guess its a clone. The script makes use of the php auto global $_SERVER[]. It stores the stuff the browser sends to the server when it makes a request to a page.

    PHP:
    <?php


    $ip 
    $_SERVER["REMOTE_ADDR"];

    $port substr($_SERVER["REMOTE_PORT"],0,2);

    $browser $_SERVER["HTTP_USER_AGENT"];

    $hostname gethostbyaddr($ip);

    echo 
    $ip;

    echo 
    " " $browser;

    echo  
    " " $hostname;

    echo 
    " " $port;

    ?>
    You dont need to use it in the same sense as the above its just a ready made example you can copy and paste and run. If your pretty good with regex you can even broaden it to show only the browser and browser version. If you do it I'd be interested in seeing how you did it. You can optionally use:

    PHP:
    $browser get_browser(nulltrue);

    print_r($browser);
    but you need to edit your config file to point to the browsercap.ini file on your server.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice