si ca peut intéresser quelqu'un (recupérer adresse ip)
si ca peut intéresser quelqu'un (recupérer adresse ip) - PHP - Programmation
MarshPosté le 13-12-2002 à 17:15:51
Sometimes you may get the IP of the ISP Cache Server which of course you do not want. To make sure you get the correct IP Address, the following may help:
Finally, note that any user can add an X-Forwarded-For header themselves. The header is only good for traceback information, never for authentication. If you use it for traceback, just log the entire X-Forwarded-For header, along with the REMOTE_ADDR.
Message édité par art_dupond le 13-12-2002 à 17:25:04
Marsh Posté le 13-12-2002 à 17:15:51
Sometimes you may get the IP of the ISP Cache Server which of course you do not want. To make sure you get the correct IP Address, the following may help:
if (getenv('HTTP_X_FORWARDED_FOR') {
$ip = getenv('HTTP_X_FORWARD_FOR';
$host = gethostbyaddr($ip);
} else {
$ip = getenv('REMOTE_ADDR';
$host = gethostbyaddr($ip);
}
http://www.php.net/manual/en/print [...] efined.php
voili
EDIT : pitit complément
Finally, note that any user can add an X-Forwarded-For header themselves. The header is only good for traceback information, never for authentication. If you use it for traceback, just log the entire X-Forwarded-For header, along with the REMOTE_ADDR.
Message édité par art_dupond le 13-12-2002 à 17:25:04
---------------
oui oui