Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   ipchicken clone code (http://www.go4expert.com/forums/ipchicken-clone-code-t22977/)

pein87 10Aug2010 04:27

ipchicken clone code
 
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 Code:

<?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 Code:

$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.


All times are GMT +5.5. The time now is 14:19.