Location: PHPKode > scripts > Turnkey Script: What is your IP? > what-is-your-ip/lib/class.ipAddress.php
<?php
/**
 * What's your IP?
 * (C) SellTurnkey.com
 */
class ipAddress
{
    //get ip address
    function getIPAddress()
    {
        if (!empty($_SERVER['HTTP_CLIENT_IP']))
        {
          $ipAddress = $_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))  
        {
          $ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
          $ipAddress = $_SERVER['REMOTE_ADDR'];
        }
        
        return $ipAddress;
    }
    
    //get browser name
    function getBrowser ()
    {
      return  $_SERVER['HTTP_USER_AGENT'];
    }
    
    //get browser info
    function getBrowserInfo ($key)
    {
        $browser = @get_browser(null, true);

        if (isset ($browser[$key]))
            return $browser[$key];
        else
            return false;
    }
}

?>
Return current item: Turnkey Script: What is your IP?