note 22750 deleted from function.getenv by rasmus

From: Date: Thu, 11 Jul 2002 16:11:42 +0000
Subject: note 22750 deleted from function.getenv by rasmus
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-32909@lists.php.net to get a copy of this message
Here's an improvement on Klemens Karssen excellent script : <?php # ascertain the user's ip address # # """"""""""""""""""""""""""""""" # $a = getenv("HTTP_X_FORWARDED_FOR"); $b = getenv("REMOTE_ADDR"); if ($a <> "") { ### [ip proxied] ### $posn=0; do { $posn++; # increment $POSN. if ($a{$posn} == ',') { # if inside the $A string, at the $POSN character -- there is a "," character break; # .. exit the do/while loop. } } while ($posn < strlen($a)); # do until the end of the $A string has been reached. $login_ip = substr($a,0,$posn); # $LOGIN_IP = from 0 to $POSN characters of $A string # $A = "nigger", [0=>4] === {nigg} } else { ### [ip standard] ### $login_ip = $b; } # ........./......... # $login_ip = $login_ip; $login_host = gethostbyaddr($login_ip); echo "<font face=courier size=-1>"; echo "&nbsp; Your IP Address is [<b>".$login_ip."</b>]<br>"; echo "Your Host Address is [<b>".$login_host."</b>]<br><br>"; echo "</font>"; ?>

« previous php.notes (#32909) next »