Skip to content

Commit ffc73af

Browse files
committed
use redirectexception
1 parent 8088ac2 commit ffc73af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

resources/lib/UnitySite.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace UnityWebPortal\lib;
44

5+
use \UnityWebPortal\lib\exceptions\RedirectException;
56
use phpseclib3\Crypt\PublicKeyLoader;
67

78
class UnitySite
@@ -10,7 +11,9 @@ public static function redirect($destination)
1011
{
1112
if ($_SERVER["PHP_SELF"] != $destination) {
1213
header("Location: $destination");
13-
die("Redirect failed, click <a href='$destination'>here</a> to continue.");
14+
// kill current PHP process, user's browser will start a new one when they HTTP GET $destination
15+
echo "Redirect failed, click <a href='$destination'>here</a> to continue.";
16+
throw new RedirectException($destination);
1417
}
1518
}
1619

0 commit comments

Comments
 (0)