30 lines
699 B
PHP
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; |