Afternoon! I am trying to check if a URL received from a post variable exists and if it does send the user there. If not redirect elsewhere... I wrote this but for some reason Is not working,
Any ideas? Cheers
<?php>
$file = $_POST["code"];
$file_headers =
@get_headers('http://example.co.uk/' $file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
/* does not exist
header('Location: http://example.co.uk/?exists=false');
echo $file 'not found';
}
else {
/* exists
header('Location: http://example.co.uk/' $file);
echo $file 'found';
};
?>