Re: IP adress problem
| From: | Jason Sheets | Date: | Tue, 16 Sep 2003 14:38:38 +0000 |
| Subject: | Re: IP adress problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162744@lists.php.net to get a copy of this message | ||
Try using global $HTTP_SERVER_VARS at the top of your function or using the $_SERVER super global which is automatically global.
Jason
Webmaster wrote:
Hi, why doesn't this work? ## IP FUNCTIONS ## function assignClientIP() { if (getenv('HTTP_X_FORWARDED_FOR') == '') { $this->aCustomer->setClientIP((!empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR )); } else { $this->aCustomer->setClientIP("Proxy"); } } The Attribut $clientIP is always empty.