Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   phphq.Net Forums (https://novahq.net/forum/forumdisplay.php?f=277)
-   -   Ip (https://novahq.net/forum/showthread.php?t=39854)

atholon 10-11-2007 07:57 PM

Ip
 
What is the best function to get a user IP for rating reasons?

Is it Getenv () PHP Function?

Lakie 10-11-2007 09:39 PM

$_SERVER['REMOTE_ADDR']; holds the IP, below should help woth users on proxies a bit too

PHP Code:

 function GetIP()
    { 
    if(isset(
$_SERVER['HTTP_X_FORWARDED_FOR']))
        
$userIP=$_SERVER['HTTP_X_FORWARDED_FOR'];
    else 
$userIP=$_SERVER['REMOTE_ADDR'];
    return 
trim($userIP);
    } 


atholon 10-11-2007 10:37 PM

sweet. THANKS YOU ROCK!


All times are GMT -5. The time now is 08:34 PM.

Powered by vBulletin®