From e827e05429469912c450d2a1ee6750fffc82dbde Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 28 Apr 2006 05:11:46 +0000 Subject: bug 349: Nicer display messages instead of "die" when urls cannot be solved (also set 404 status code for bots) git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1287 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_html.inc.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/functions_html.inc.php') diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index bc967b752..65cbc879c 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -591,4 +591,22 @@ function access_denied() redirect($login_url); } } + +/** + * exits the current script with 404 code when a page cannot be found + * @param string msg a message to display + * @param string alternate_url redirect to this url + */ +function page_not_found($msg, $alternate_url=null) +{ + header('HTTP/1.1 404 Not found'); + header('Status: 404 Not found'); + if ($alternate_url==null) + $alternate_url = make_index_url(); + redirect( $alternate_url, + '
+

Page not found


' +.$msg.'
', + 5 ); +} ?> -- cgit v1.2.3