Verified Commit 267f245a authored by Luc Didry's avatar Luc Didry
Browse files

— Send visitor’s IP address if user agent is curl of wget and no IP is send

parent 9eedb440
......@@ -7,7 +7,6 @@
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$visitor_ip = htmlspecialchars($visitor_ip);
// Process IP address
if (isset($_GET['ip']) && $_GET['ip'] !== '') {
......@@ -40,6 +39,12 @@
$err = "Désolée, ".$ipclean." n’est pas une adresse IP valide.";
}
} else {
// Request is made with curl or wget (or with modified user agent header)
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/(curl|wget)/i", $_SERVER['HTTP_USER_AGENT'])) {
echo $visitor_ip;
return;
}
$description = "Pour voir les infos géographiques d’une adresse IP";
}
......@@ -53,6 +58,7 @@
}
return;
}
$visitor_ip = htmlspecialchars($visitor_ip);
?>
<!DOCTYPE html>
<html lang="fr">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment