note 40020 deleted from function.return by aidan

From: Date: Thu, 26 Aug 2004 01:35:21 +0000
Subject: note 40020 deleted from function.return by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75269@lists.php.net to get a copy of this message
Note Submitter: LoKi at legion-of-fortitude dot net ---- Here is a nifty little function that returns the IP of the person browsing the site. <?php function get_ip() { if (isSet($_SERVER)) { if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) { $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) { $realip = $_SERVER["HTTP_CLIENT_IP"]; } else { $realip = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) { $realip = getenv( 'HTTP_CLIENT_IP' ); } else { $realip = getenv( 'REMOTE_ADDR' ); } } return $realip; } ?>

« previous php.notes (#75269) next »