note 10608 modified in function.gethostbyaddr by irchtml

From: Date: Tue, 02 Mar 2004 11:28:56 +0000
Subject: note 10608 modified in function.gethostbyaddr by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66094@lists.php.net to get a copy of this message
if the user is sitting behind a proxy server, you can do this; <? if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){ $IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; $proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]); }else{ $IP = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]); } ?> ps; i use $HTTP_SERVER_VARS["something"] instead of just $something; you can get most of the $HTTP_SERVER_VARS by just using there $something equivalent, see the manual for that (preserved variables) --was-- if the user is sitting behind a proxy server, you can do this; &lt;? if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){ $IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; $proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]); }else{ $IP = $HTTP_SERVER_VARS["REMOTE_ADDR"]; $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]); } ?> ps; i use $HTTP_SERVER_VARS["something"] instead of just $something; you can get most of the $HTTP_SERVER_VARS by just using there $something equivalent, see the manual for that (preserved variables) http://www.php.net/manual/en/function.gethostbyaddr.php

« previous php.notes (#66094) next »