Increased security for getIP() function

This commit is contained in:
Brent Hopkins 2023-05-18 05:41:06 -05:00 committed by GitHub
parent c403380562
commit 23f7866c8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -85,6 +85,9 @@ function getIP() {
} else {
$ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER['REMOTE_ADDR'];
}
if (!filter_var($ip, FILTER_VALIDATE_IP))
die("Potential Security Violation");
return $ip;
}