I have a website where you visit where the URL parameters define where you should go, but now I also want a default state, where you get send when you visit without any URL parameters.
This is what it looks like:
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
ob_start();
echo strstr($link, 'directory');
$link2 = ob_get_contents();
ob_end_clean();
echo("$link2"); //the reason I have this was to test, it returns empty
if (!empty($_GET['link2'])) {
$link2 = "directory=four";
}
So what it does is just get the URL, remove everything that comes before directory
, but this doesn't set the directory
to four
, but here it just goes to localhost/guards/game.php?
$aaaa=("http://localhost/guard/game.php?$link2");
?>
<script type="text/javascript">
window.location = "<?php echo $aaaa ?>";
</script>
Aucun commentaire:
Enregistrer un commentaire