mirror of
https://github.com/jakejarvis/simpip.git
synced 2025-06-27 16:15:41 -04:00
fix HTTP_X_FORWARDED_FOR returning 127.0.0.1
This commit is contained in:
13
index.php
13
index.php
@ -1 +1,12 @@
|
||||
<?php header("Content-type: text/plain"); echo ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; ?>
|
||||
<?php
|
||||
header("Content-type: text/plain");
|
||||
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
if (($pos = strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ",")) !== false) {
|
||||
echo substr($_SERVER['HTTP_X_FORWARDED_FOR'], 0, $pos);
|
||||
} else {
|
||||
echo $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
} else {
|
||||
echo $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user