public function __construct() { parent::__construct(); $app = App::getInstance(); $auth = new DBAuth($app->getDb()); if (!$auth->logged()) { $this->forbidden(); } }
public function __construct() { parent::__construct(); $app = App::getInstance(); $auth = new DBAuth($app->getDb()); if (!$auth->logged()) { $this->forbidden(); } /*$logged = false; $this->render('templates.default', compact('logged'));*/ }
public function login() { $errors = false; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location: index.php?page=admin.post.index'); } else { $errors = true; } } $form = new FoundationForm($_POST); $this->render('user.login', compact('form', 'errors')); }
public function login() { $errors = false; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location: index.php?page=admin.articles.index'); } else { var_dump($this->Users); $errors = true; var_dump($this->Users); } } $form = new BootstrapForm($_POST); $this->render('users.login', compact('form', 'errors')); }
<?php use Core\HTML\DafstyleForm; use Core\Auth\DBAuth; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location:admin.php'); } else { ?> <div class="alert alert-warm">Identifiant ou mot de passe incorrect.</div><?php } } $form = new DafstyleForm($_POST); ?> <div class="daf-gr-ctnr"> <div class="daf-sct-10"> <div class="alert titro">Connexion au back-office</div> <form method="post"> <?php echo $form->input('username', 'Nom d\'utilisateur'); ?> <?php echo $form->input('password', 'Mot de passe', ['type' => 'password']); ?> <button class="btn btn-primary">Connexion</button> </form> </div> </div>
<?php use Core\Auth\DBAuth; // Paths define('ROOT', dirname(__DIR__)); define('CSSROOT', str_replace('/var/www/html', '', dirname(__DIR__)) . '/public/css'); // Autoloading require ROOT . '/app/App.php'; App\App::load(); isset($_GET['page']) ? $page = $_GET['page'] : ($page = 'home'); // Auth $app = App\App::getInstance(); $auth = new DBAuth($app->getDb()); if (!$auth->logged()) { $app->forbidden(); } ob_start(); // Posts if ($page === 'home') { require ROOT . '/pages/admin/posts/index.php'; } elseif ($page === 'post.edit') { require ROOT . '/pages/admin/posts/edit.php'; } elseif ($page === 'post.add') { require ROOT . '/pages/admin/posts/add.php'; } elseif ($page === 'post.delete') { require ROOT . '/pages/admin/posts/delete.php'; } elseif ($page === 'category.index') { require ROOT . '/pages/admin/categories/index.php'; } elseif ($page === 'category.add') { require ROOT . '/pages/admin/categories/add.php'; } elseif ($page === 'category.edit') {