} //Object Instantiation $acct = new Account(); $userMapper = new UserMapper(); $gameMapper = new GameMapper(); //Form submission checker logic if (count($_POST) > 0) { $form = new Form(); try { //If the login form is submitted, log in to the user's account if ($_POST['form'] === 'login') { $acct->login(); } else { if ($_POST['form'] === 'register') { //Form Validation if ($form->validateAddUser()) { //If validation passes, add the user to the database. $user = new GameMania\Model\User(0, $_POST['username'], $_POST['email'], hash("sha256", $_POST['password'])); //If the user is successfully registered, tell them. if ($userMapper->addUser($user)) { $msg = "Successfully registered the user!"; } } } else { if ($_POST['form'] === 'addProduct') { //Form Validation if ($form->validateAddGame()) { //If validation passes, add the game to the database. $game = new GameMania\Model\Game(0, $_POST['title'], $_POST['developer'], $_POST['console'], $_POST['price'], $_POST['rating'], $_POST['comments']); //If the game is successfully added, tell the user. if ($gameMapper->addGame($game)) {