Esempio n. 1
0
function controleAuthentification()
{
    if (isset($_SESSION['ident'])) {
        return true;
    }
    if (!(isset($_POST['login']) && isset($_POST['password']))) {
        throw new Exception('champs vide');
    }
    $login = $_POST['login'];
    $password = $_POST['password'];
    $personne = authentifie($login, $password);
    if (!$personne) {
        throw new Exception('login/password incorrects');
    }
    $_SESSION['ident'] = $personne;
    return true;
}
Esempio n. 2
0
function controleAuthentification()
{
    if (isset($_SESSION['ident'])) {
        return true;
    }
    $login = inputFilterString('login');
    $password = inputFilterString('password');
    $personne = authentifie($login, $password);
    if (!$personne) {
        $_SESSION['echec'] = TRUE;
        throw new Exception('login/password incorrects');
    }
    $_SESSION['ident'] = $personne;
    //ou serialize($ident);
    restaureContexteUtilisateur($personne);
    unset($_SESSION['echec']);
    // au cas où c'était positionné
    return true;
}