note 22752 deleted from language.variables.predefined by jmcastagnetto

From: Date: Thu, 15 Aug 2002 22:22:19 +0000
Subject: note 22752 deleted from language.variables.predefined by jmcastagnetto
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35100@lists.php.net to get a copy of this message
Here's an improvement for the excellent script from : just4fun@amberstudios.org <?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 (#35100) next »