diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_html.inc.php | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 37f4d8a59..7e7df7c41 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -5,7 +5,7 @@ // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) -// | file : $RCSfile$ +// | file : $Id$ // | last update : $Date$ // | last modifier : $Author$ // | revision : $Revision$ @@ -493,4 +493,30 @@ function get_cat_display_name_from_id($cat_id, $cat_info = get_cat_info($cat_id); return get_cat_display_name($cat_info['name'], $url, $replace_space); } -?> + +/** + * exits the current script (either exit or redirect) + */ +function access_denied() +{ + global $user, $lang; + + $login_url = + get_root_url().'identification.php?redirect=' + .urlencode(urlencode($_SERVER['REQUEST_URI'])); + + if ( isset($user['is_the_guest']) and !$user['is_the_guest'] ) + { + echo '<div style="text-align:center;">'.$lang['access_forbiden'].'<br />'; + echo '<a href="'.get_root_url().'identification.php">'.$lang['identification'].'</a> '; + echo '<a href="'.make_index_url().'">'.$lang['home'].'</a></div>'; + exit(); + } + else + { + header('HTTP/1.1 401 Authorization required'); + header('Status: 401 Authorization required'); + redirect($login_url); + } +} +?>
\ No newline at end of file |