Ejemplo n.º 1
0
 function accueil()
 {
     $success = array('success' => '1');
     if (isset($_POST)) {
         if (isset($_POST['username']) && isset($_POST['password'])) {
             require_once WEBAPPROOT . 'security/AuthentificationManager.php';
             $username = $_POST['username'];
             $password = $_POST['password'];
             $auth = new AuthentificationManager();
             $password_hash = md5($password);
             $result = $auth->login($username, $password_hash);
             if ($result == null) {
                 //traiter erreur
                 $success = array('success' => '0');
             } else {
                 if ($result->getIs_admin() == '1') {
                     $this->redirect('admin/home');
                 } else {
                     $success = array('success' => '0');
                 }
             }
         }
     }
     require_once WEBAPPROOT . 'security/AuthentificationManager.php';
     $auth = new AuthentificationManager();
     if ($auth->getUser() != null) {
         if ($auth->getUser()->getIs_admin() == '1') {
             $this->redirect('admin/home');
         }
     }
     $this->set($success);
     $this->partialView('connecter');
 }
Ejemplo n.º 2
0
 function logout()
 {
     require_once WEBAPPROOT . 'security/AuthentificationManager.php';
     $auth = new AuthentificationManager();
     $auth->logout();
     $this->redirect('admin');
     exit;
 }
Ejemplo n.º 3
0
 function getUser()
 {
     require_once WEBAPPROOT . 'security/AuthentificationManager.php';
     $auth = new AuthentificationManager();
     //print_r($auth->getUser());
     //$user = UserSession::getUser();
     return $auth->getUser();
 }
Ejemplo n.º 4
0
 function logout()
 {
     require_once WEBAPPROOT . 'security/AuthentificationManager.php';
     $auth = new AuthentificationManager();
     $auth->logout();
     header("Location: " . ROOT);
     exit;
 }