Exemple #1
0
 function __construct()
 {
     parent::__construct();
     Session::init();
     if (!Session::get('pet')) {
         header('Location: ' . URL . 'index');
         exit;
     }
 }
Exemple #2
0
 function run()
 {
     $sth = $this->db->prepare("SELECT userid, role FROM user WHERE \n\t\t\tusername = :username AND password = :password");
     $sth->execute(array(':username' => $_POST['username'], ':password' => \Libs\Hash::create('sha256', $_POST['password'], HASH_PASSWORD_KEY)));
     $data = $sth->fetch();
     $count = $sth->rowCount();
     if ($count > 0) {
         // login
         \Libs\Session::init();
         \Libs\Session::set('role', $data['role']);
         \Libs\Session::set('loggedIn', true);
         \Libs\Session::set('userid', $data['userid']);
         header('location: ../dashboard');
     } else {
         header('location: ../login');
     }
 }
Exemple #3
0
 function __construct()
 {
     parent::__construct();
     Session::init();
 }
Exemple #4
0
public/js/custom.js"></script>

	<?php 
if (isset($this->js)) {
    foreach ($this->js as $js) {
        echo '<script type="text/javascript" src="' . URL . 'views' . $js . '"></script>';
    }
}
?>

</head>

<body>

<?php 
\Libs\Session::init();
?>

<header>
	<?php 
if (\Libs\Session::get('loggedIn') == false) {
    ?>
		<a href="<?php 
    echo URL;
    ?>
index">Index</a>
		<a href="<?php 
    echo URL;
    ?>
help">Help</a>
	<?php