public function restrictAdmin() { if (!$this->session->read('authAdmin')) { $this->session->setFlash('danger', "Vous n'êtes pas Admin, vous n'avez pas les droits nécessaires"); theApp::redirect('../action/login.php'); } }
<?php /** * Created by PhpStorm. * User: moussa * Date: 22/01/2016 * Time: 19:31 */ require '../inc/bootstrap.php'; theApp::getAuth()->logout(); Session::getInstance()->setFlash('success', "Vous avez bien été déconnecté au revoir et à bientôt"); theApp::redirect('login.php');
<?php require_once '../inc/bootstrap.php'; $user_id = $_GET['id']; $token = $_GET['token']; $db = theApp::getDataBase(); $auth = theApp::getAuth(); if ($auth->confirm($db, $user_id, $token)) { Session::getInstance()->setFlash('success', 'Votre compte a été bien crée!'); theApp::redirect('../client'); } else { Session::getInstance()->setFlash('danger', 'Ce lien n\'est pas valide!!'); theApp::redirect('../action/login.php'); }
$auth = theApp::getAuth(); $db = theApp::getDataBase(); $auth->reconnect_from_cookie($db); /*if($auth->user()){ theApp::redirect('index.php'); }*/ if (!empty($_POST) && !empty($_POST['username']) && !empty($_POST['password'])) { $user = $auth->login($db, $_POST['username'], $_POST['password'], isset($_POST['remember'])); $session = Session::getInstance(); if ($user) { if ($user->isAdmin) { $session->setFlash('success', "Vous êtes maintenant bien connecté. Vous êtes l'administrateur de ce site !"); theApp::redirect('../admin'); } else { $session->setFlash('success', "Vous êtes maintenant bien connecté !"); theApp::redirect('../client/'); } } else { $session->setFlash('danger', "Mot de pass ou identifiant incorrect!"); } } require '../inc/header.php'; ?> <form action="" method="POST"> <div class="form-group"> <label for="">Pseudo ou Email</label> <input type="text" name="username" class="form-control"> </div> <div class="form-group">