Exemple #1
0
<?php

include_once dirname(__FILE__) . '/Authentication.php';
include_once dirname(__FILE__) . '/StudIPAuthentication.php';
$auth = new Authentication();
$StudIPauth = new StudIPAuthentication();
$invalidLogin = Authentication::checkLogin() == false;
$shouldLogOut = isset($_GET['action']) && $_GET['action'] == "logout";
if ($invalidLogin == true || $shouldLogOut == true) {
    // the user's login is no longer valid or he requested to be logged out
    Authentication::logoutUser();
}
Exemple #2
0
    $signed = $auth->loginUser($input['username'], $input['password']);
    if ($signed === true) {
        header('Location: ' . $input['back']);
        exit;
    } else {
        if ($signed !== false) {
            $notifications[] = $signed;
        } else {
            $notifications[] = MakeNotification("error", Language::Get('main', 'errorLogin', $langTemplate));
        }
    }
} else {
    $notifications = array();
}
// check if already logged in
if (Authentication::checkLogin()) {
    header('Location: index.php');
    exit;
}
// construct a new header
$h = Template::WithTemplateFile('include/Header/Header.template.html');
$h->bind(array("backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "name" => Language::Get('main', 'title', $langTemplate), "hideBackLink" => "true", "hideLogoutLink" => "true", "notificationElements" => $notifications));
// construct a login element
$userLogin = Template::WithTemplateFile('include/Login/Login.template.html');
// if back Parameter is given bind it to the userLogin to create hidden input
if (isset($_GET['back'])) {
    $backparameter = cleanInput($_GET['back']);
    $backdata = array("backURL" => $backparameter);
} else {
    $backdata = array();
}