public function __construct($db)
 {
     parent::__construct();
     $this->db = $db;
     $this->filename = 'loginForm.php';
     $registerTab = !empty($_GET['tab']) && $_GET['tab'] == 'register';
     if (empty($_SESSION['id']) && $registerTab && !empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['password2'])) {
         $this->register($_POST['username'], $_POST['password'], $_POST['password2']);
     }
     $signinTab = empty($_GET['tab']) || $_GET['tab'] == 'signin';
     if (empty($_SESSION['id']) && $signinTab && !empty($_POST['username']) && !empty($_POST['password'])) {
         $this->checkLogin($_POST['signinUsername'], $_POST['signinPassword']);
     }
     if (!empty($_GET['logout'])) {
         session_start();
         session_destroy();
         header('Location: index.php');
         die;
     }
     $this->variables['tab'] = 'login';
     if ($registerTab) {
         $this->variables['tab'] = 'register';
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     $messages = new \classes\Messages();
     $variables['unreadMessages'] = $messages->getUnread();
 }
 public function __construct($user)
 {
     parent::__construct();
     $this->user = $user;
 }