-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Mikhail Fedosov
committed
May 11, 2024
1 parent
0773216
commit 51bd3b3
Showing
4 changed files
with
25 additions
and
42 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,16 @@ | ||
<?php | ||
|
||
if (array_key_exists ("redirect", $_GET) && $_GET['redirect'] != "") { | ||
if (!empty($_GET['redirect'])) { | ||
if (strpos($_GET['redirect'], "info.php") !== false) { | ||
header ("location: " . $_GET['redirect']); | ||
exit; | ||
} else { | ||
http_response_code (500); | ||
?> | ||
<p>You can only redirect to the info page.</p> | ||
<?php | ||
echo "You can only redirect to the info page."; | ||
exit; | ||
} | ||
} | ||
|
||
http_response_code (500); | ||
?> | ||
<p>Missing redirect target.</p> | ||
<?php | ||
echo "Missing redirect target."; | ||
exit; | ||
?> |
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,29 +1,23 @@ | ||
<?php | ||
|
||
$target = ""; | ||
$redirects = [ | ||
1 => "info.php?id=1", | ||
2 => "info.php?id=2", | ||
99 => "https://digi.ninja", | ||
]; | ||
|
||
if (array_key_exists ("redirect", $_GET) && is_numeric($_GET['redirect'])) { | ||
switch (intval ($_GET['redirect'])) { | ||
case 1: | ||
$target = "info.php?id=1"; | ||
break; | ||
case 2: | ||
$target = "info.php?id=2"; | ||
break; | ||
case 99: | ||
$target = "https://digi.ninja"; | ||
break; | ||
} | ||
if ($target != "") { | ||
header ("location: " . $target); | ||
exit; | ||
} else { | ||
?> | ||
Unknown redirect target. | ||
<?php | ||
exit; | ||
} | ||
if (!empty($_GET['redirect'])) { | ||
$redirectId = $_GET['redirect']; | ||
$target = $redirects[$redirectId] ?? ""; | ||
if ($target !== "") { | ||
header("Location: " . $target); | ||
exit; | ||
} else { | ||
echo "Unknown redirect target."; | ||
exit; | ||
} | ||
} | ||
|
||
echo "Missing redirect target."; | ||
exit; | ||
?> | ||
Missing redirect target. |
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,13 +1,11 @@ | ||
<?php | ||
|
||
if (array_key_exists ("redirect", $_GET) && $_GET['redirect'] != "") { | ||
if (!empty($_GET['redirect'])) { | ||
header ("location: " . $_GET['redirect']); | ||
exit; | ||
} | ||
|
||
http_response_code (500); | ||
?> | ||
<p>Missing redirect target.</p> | ||
<?php | ||
echo "Missing redirect target."; | ||
exit; | ||
?> |
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