authenticate($username,$password); if(!$user) { die("Password or username is incorrect"); } $_SESSION['username'] = $user->username; $_SESSION['user_object'] = $user; header('Location: /'); ?>