forked from asterjdm/Cesco-Leak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c51fb11
commit 0af52f1
Showing
1 changed file
with
17 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
<?php | ||
function getClientIp() { | ||
$ipaddress = ''; | ||
if (isset($_SERVER['HTTP_CLIENT_IP'])) | ||
$ipaddress = $_SERVER['HTTP_CLIENT_IP']; | ||
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) | ||
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | ||
else if(isset($_SERVER['HTTP_X_FORWARDED'])) | ||
$ipaddress = $_SERVER['HTTP_X_FORWARDED']; | ||
else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) | ||
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; | ||
else if(isset($_SERVER['HTTP_FORWARDED'])) | ||
$ipaddress = $_SERVER['HTTP_FORWARDED']; | ||
else if(isset($_SERVER['REMOTE_ADDR'])) | ||
$ipaddress = $_SERVER['REMOTE_ADDR']; | ||
else | ||
$ipaddress = 'UNKNOWN'; | ||
return $ipaddress; | ||
} | ||
$headers = [ | ||
'HTTP_CLIENT_IP', | ||
'HTTP_X_FORWARDED_FOR', | ||
'HTTP_X_FORWARDED', | ||
'HTTP_FORWARDED_FOR', | ||
'HTTP_FORWARDED', | ||
'REMOTE_ADDR' | ||
]; | ||
|
||
foreach ($headers as $header) { | ||
if (isset($_SERVER[$header])) { | ||
return $_SERVER[$header]; | ||
} | ||
} | ||
|
||
?> | ||
return 'UNKNOWN'; | ||
} | ||
?> |