Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkLogin() {
- global $errorMessage;
- $username = $_POST['inputEmail'];
- $password = $_POST['inputPassword'];
- $remember = isset($_POST['remember-me']);
- try {
- $account = Account::getAccount($username, $password);
- } catch (Exception $ex) {
- $errorMessage = "An internal error occured :(. We're sorry about this.<br>";
- }
- if ($account) {
- $_SESSION['account'] = $account;
- if ($remember) {
- setcookie('account', serialize($account), time() + (86400 * 30), '/');
- }
- header('Location: admin.php');
- } else {
- $errorMessage .= "Incorrect username or password. Please try again.";
- }
- }
- function logout() {
- $_SESSION['account'] = null;
- session_destroy();
- setcookie('account', null, -1, '/');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement