public function index() { $view = $this->__common(new View(LoginView)); $view->isLoggedIn = Authentification::isLoggedIn(); $view->title = 'Craiglist | ' . 'Sign in!'; if (isset($_POST['login'])) { $login = new Authentification(); $login->login(array('username' => $_POST['username'], 'password' => $_POST['password'], 'token' => $_POST['token'])); $view->token = $_SESSION['token'] = md5(uniqid(mt_rand(), true)); if (Authentification::isLoggedIn()) { header('Location:' . SERVER_ROOT_URL); } } print $view->display(); }