public function login() { if (Tools::illegalRequest(array("username", "password"))) { return false; } if (func_num_args() != 0) { return false; } // Check that the function is called with correct number of arguments if ($_SERVER['REQUEST_METHOD'] == 'POST') { try { $user = User::loginCheck(); $_SESSION['auth'] = true; $_SESSION['id'] = $user->id; $_SESSION['mail'] = $user->email; Router::goHome(); } catch (Exception $e) { $vars['error'] = $e->getMessage(); new View('login.tpl', $vars); } } else { new View('login.tpl'); } return true; }