1
0
mirror of https://github.com/php/web-php.git synced 2026-03-24 07:12:16 +01:00

Maybe some mirrors are using symlinks for the docroot, thats why its failing?

This commit is contained in:
Hannes Magnusson
2013-11-22 00:48:56 -08:00
parent 1d2a2e9ef6
commit c7cdf75158

View File

@@ -6,11 +6,12 @@ if (!isset($_GET["f"])) {
header("Location: http://php.net/");
exit;
}
$abs = $_SERVER["DOCUMENT_ROOT"]. "/" .(string)$_GET["f"];
$pwd = realpath($_SERVER["DOCUMENT_ROOT"]);
$abs = $pwd. "/" .(string)$_GET["f"];
$abs = realpath($abs);
if (strncmp($abs, $_SERVER["DOCUMENT_ROOT"], strlen($_SERVER["DOCUMENT_ROOT"])) != 0) {
header("Location: http://php.net");
if (strncmp($abs, $pwd, strlen($pwd)) != 0) {
header("Location: http://php.net/$abs");
exit;
}