* */ $bn_action="login"; define("no_auth_required", 1); // Don't authenticate the user, he want to login !! require ("init.inc"); # Execute before_access program # ----------------------------- if (!empty($before_access)) include $before_access; # redirect to the LOGIN page if defined # ------------------------------------- $newURL = $auth->getLoginURL(); if (is_string($newURL)) { if (empty($newURL)) { display_header ('', $header_footer); msgForm (ERROR_FEATURE_DISABLED, $WA_SELF, 'back'); display_footer ($header_footer); } else { header("Location: $newURL"); } exit; } # set the url where to redirect if login is successful, # can be set by the following methods (by decreasing priority) : # # 1. Using the 'redirect' parameter in the URL => login.php?site=mysite&redirect=mypage.php # 2. In the before access file: # if ($bn_action=="login") {$redirect_url = "mypage.php";} # 3. Using the 'redirect_url' hidden field in the form template : # eg. # --------------------------------------------------------------------- if (!empty($HTTP_GET_VARS['redirect'])) { $redirect_url = $HTTP_GET_VARS['redirect']; } elseif (!empty($HTTP_POST_VARS['redirect'])) { $redirect_url = $HTTP_POST_VARS['redirect']; } elseif (empty($redirect_url) && !empty($HTTP_POST_VARS['redirect_url'])) { $redirect_url = $HTTP_POST_VARS['redirect_url']; } if (isset($loginform)) { # if login form has been submitted then authenticate him # ------------------------------------------------------ if ($is_authenticated) { if (empty($redirect_url) ) { display_header (TITLE_WELCOME, $header_footer); printf(MSG_WELCOME, $auth->user["username"], anchor($main_page, ($bn_frames==1) ? '_top': '', ALT_WELCOME) ); } elseif ($bn_frames) { display_header (TITLE_WELCOME, $header_footer); printf(MSG_WELCOME, $auth->user["username"], anchor($redirect_url, '_top', ALT_WELCOME, '') ); } else { header ("Location: ". expandUrl($redirect_url) ); } } else { display_header (ERROR_INVALID_LOGIN, $header_footer); $auth->login ($site); } } else { # else we present the login form # ------------------------------ // if ($is_authenticated) { // $auth->logout($site); // } display_header (LABEL_PLEASE_LOGIN, $header_footer); $auth->login ($site); } display_footer ($header_footer); ?>