note 36790 deleted from function.getenv by bjori

From: Date: Sat, 25 Mar 2006 10:58:32 +0000
Subject: note 36790 deleted from function.getenv by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106577@lists.php.net to get a copy of this message
Note Submitter: info at barclaey nospam dot com ---- Joenema at aol dot com, there is a syntax error in your note. You forgot a hyphen after HTTP_X_FORWARDED_FOR. This is the correct code: function getIP() { $ip; if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "UNKNOWN"; return $ip; }

« previous php.notes (#106577) next »