note 22752 added to language.variables.predefined
| From: | matthew_a_carson at hotmail dot com | Date: | Fri, 28 Jun 2002 12:25:48 +0000 |
| Subject: | note 22752 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32367@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 " Your IP Address is
[<b>".$login_ip."</b>]<br>";
echo "Your Host Address is
[<b>".$login_host."</b>]<br><br>";
echo "</font>";
?>
--
http://www.php.net/manual/en/language.variables.predefined.php
http://master.php.net/manage/user-notes.php?action=edit+22752
http://master.php.net/manage/user-notes.php?action=delete+22752
http://master.php.net/manage/user-notes.php?action=reject+22752