Files
Backend/WEBROOT/controller/RoutesController.php
T
2026-01-26 17:45:55 +01:00

30 lines
699 B
PHP

<?php
// logging();
if (!isset($_GET['website'])) {
die("Fehlender Parameter: website");
}
$website = trim($_GET['website']);
$blocked_schemes = ['javascript:', 'data:', 'file:'];
foreach ($blocked_schemes as $scheme) {
if (stripos($website, $scheme) === 0) {
die("Ungültige URL.");
}
}
if (preg_match('/^https?:\/\//i', $website)) {
header("Location: " . $website);
exit;
}
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$domain = $_SERVER['HTTP_HOST'];
$website = ltrim($website, "/");
$redirectUrl = $protocol . $domain . "/" . $website;
header("Location: " . $redirectUrl);
exit;