/**
 * Display login page.
 * NOTE: This function calls exit() after execution.
 */
function F_login_form()
{
    global $l, $thispage_title;
    global $xuser_name, $xuser_password;
    require_once '../config/tce_config.php';
    require_once '../../shared/code/tce_functions_form.php';
    $thispage_title = $l['t_login_form'];
    //set page title
    require_once '../code/tce_page_header.php';
    echo F_loginForm($_SERVER['SCRIPT_NAME'], 'form_login', 'post', 'multipart/form-data', $xuser_name, $xuser_password, 20);
    require_once '../code/tce_page_footer.php';
    exit;
    //break page here
}
/**
 * Display login page.
 * NOTE: This function calls exit() after execution.
 */
function F_login_form()
{
    global $l, $thispage_title;
    global $xuser_name, $xuser_password;
    require_once '../config/tce_config.php';
    require_once '../../shared/config/tce_httpbasic.php';
    if (K_HTTPBASIC_ENABLED and (!isset($_SESSION['logout']) or !$_SESSION['logout'])) {
        // force HTTP Basic Authentication
        header('WWW-Authenticate: Basic realm="TCExam"');
        header('HTTP/1.0 401 Unauthorized');
        require_once '../code/tce_page_header.php';
        F_print_error('WARNING', $l['m_authorization_denied']);
        require_once '../code/tce_page_footer.php';
        exit;
        //break page here
    }
    require_once '../../shared/code/tce_functions_form.php';
    $thispage_title = $l['t_login_form'];
    //set page title
    require_once '../code/tce_page_header.php';
    echo F_loginForm($_SERVER['SCRIPT_NAME'], 'form_login', 'post', 'multipart/form-data', $xuser_name, $xuser_password, 20);
    require_once '../code/tce_page_footer.php';
    exit;
    //break page here
}
/**
 * Display login page.
 * NOTE: This function calls exit() after execution.
 */
function F_login_form()
{
    global $l, $thispage_title;
    global $xuser_name, $xuser_password;
    require_once '../config/tce_config.php';
    // HTTP-Basic authentication
    require_once '../../shared/config/tce_httpbasic.php';
    if (K_HTTPBASIC_ENABLED and (!isset($_SESSION['logout']) or !$_SESSION['logout'])) {
        // force HTTP Basic Authentication
        header('WWW-Authenticate: Basic realm="TCExam"');
        header('HTTP/1.0 401 Unauthorized');
        require_once '../code/tce_page_header.php';
        F_print_error('WARNING', $l['m_authorization_denied']);
        require_once '../code/tce_page_footer.php';
        exit;
        //break page here
    }
    // Shibboleth authentication
    require_once '../../shared/config/tce_shibboleth.php';
    if (K_SHIBBOLETH_ENABLED and (!isset($_SESSION['logout']) or !$_SESSION['logout'])) {
        // redirect to Shibboleth Login Page
        header('Location: ' . K_SHIBBOLETH_LOGIN);
        // html redirect
        echo '<' . '?xml version="1.0" encoding="' . $l['a_meta_charset'] . '"?' . '>' . K_NEWLINE;
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . K_NEWLINE;
        echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $l['a_meta_language'] . '" lang="' . $l['a_meta_language'] . '" dir="' . $l['a_meta_dir'] . '">' . K_NEWLINE;
        echo '<head>' . K_NEWLINE;
        echo '<title>LOGIN</title>' . K_NEWLINE;
        echo '<meta http-equiv="refresh" content="0" />' . K_NEWLINE;
        //reload page
        echo '</head>' . K_NEWLINE;
        echo '<body>' . K_NEWLINE;
        echo '<a href="' . K_SHIBBOLETH_LOGIN . '">LOGIN</a>' . K_NEWLINE;
        echo '</body>' . K_NEWLINE;
        echo '</html>' . K_NEWLINE;
        exit;
        //break page here
    }
    require_once '../../shared/code/tce_functions_form.php';
    $thispage_title = $l['t_login_form'];
    //set page title
    require_once '../code/tce_page_header.php';
    echo F_loginForm($_SERVER['SCRIPT_NAME'], 'form_login', 'post', 'multipart/form-data', $xuser_name);
    require_once '../code/tce_page_footer.php';
    exit;
    //break page here
}