...

View Full Version : Trigger an Error404 with PHP



guvenck
07-14-2008, 11:40 AM
Hello,

I need to produce an Error 404 with PHP.

I want some users be able to access the file.php (based on their permissions) if they are allowed to.

For the ones who don't have access to file.php, I don't want to display a "You are not allowed" kind of message, but an Error 404, as if the file does not exist.

How can I do that? I don't want to use the header command to another file, since it would display the name of the second file in the address bar.

abduraooft
07-14-2008, 12:03 PM
See http://in.php.net/header,

<?php
header("HTTP/1.0 404 Not Found");
?>

guvenck
07-15-2008, 06:51 PM
Thanks for the suggestion.

Unfortunately, it does not produce a Error 404 for me, but a blank page instead. What could be the problem?

What about



<?php

header("Location: nonexistent404.php");

?>


and produce a real 404 error?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum