I'm working on php page that will not open if it wasn't referred by "xxxxxxx.php"
So my code is :
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$confirm = 'http://localhost/test/xxxxxx.php';
if ($referer == $confirm) {
echo 'You correct';
} else {
echo 'wronnnnnnnnnnng';
}
And here's xxxxxx.php content :
header("Location: http://localhost/test/code.php");
But unfortunate it doesn't work, But if I make it as echo like this
echo '<p><a href="http://localhost/test/code.php">here</a></p>';
It's working fine, But I want it to redirect not when user click on the link so I want header redirect to work so any ideas on how to get it work ?
Thanks.