default to something like home.php.

I've been playing with something like this a little. I have an some other questions:

What if I want to return a 404 instead? How do I raise a 404 response error in PHP?

More specifically, I've got a bit of code like this:

<? 

if (file_exists($f)) {
output_header();
include($f);
output_footer();
}
else {
header('HTTP/1.0 404 Not Found');
}


...which works, but I'd like to raise the 404 error in such a way that Apache serves my ErrorDocument. Is this possible?

Oh, and a security question: currently, this allows access outside the webserver's directories (you can use /index.php?f=/etc/passwd for example). Any good tips on avoiding this kind of problem?


Edited by Roger (22/03/2004 06:49)
_________________________
-- roger