I have this code in the index.php of a domain:
<?php
if (isset($_POST["redirect"])) {
$hash = $_POST["redirect"];
if ($hash !== "") {
$origen = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "";
$destino = "";
if($origen == 'http://www.example.net/test') $destino = 'https://www.test.com/ad';
else if($origen == 'http://www.example.net/test2') $destino = 'https://test.com/ad2';
if($destino != "")
{
echo "<script>window.location.href = '".$destino."';</script>";
}
}
}
?>
So far everything is correct, because if the user enters from one of the referers specified, it goes to the URL specified according to the entry referer, but if the user enters from any other referer that is not any of the mentioned ones ( or that the referer is blank) the user stays in that same URL (of this index.php) blank. How can I make the user go to a specific URL (and not stay in the current index) for all other cases?