public function setUp() { $this->genre = "Bouncing"; $this->the_title = "My First DVD Title"; add_genre($this->genre, "A description of {$genre}"); $values = array($this->the_title, "2005", "Bob Jangles", "18", $this->genre); add_dvd($values); $this->testusername = "******"; $this->testpassword = "******"; add_user($this->testusername, $this->testpassword); // store in object so we can use them later on. }
<?php session_start(); require_once "dvd-db.php"; require_once "dvd-util.php"; ensure_authenticated(); if (array_key_exists('confirm_add', $_POST)) { global $_SESSION; $new_dvd = $_SESSION['new_dvd']; try { add_dvd($new_dvd); add_message("Your DVD was successfully added!"); } catch (DbException $dbe) { add_error("An Error occurred while trying to add your DVD: \n<br />\t" . $dbe->getMessage()); } } header("Location: index.php");
<?php session_start(); require_once "dvd-db.php"; require_once "dvd-util.php"; ensure_authenticated(); if (array_key_exists('confirm_add', $_POST)) { global $_SESSION; $new_dvd = $_SESSION['new_dvd']; $error = add_dvd($new_dvd); if ($error == NULL) { add_message("Your DVD was successfully added!"); } else { add_error("Sorry, a server error prevented the dvd from being added.\n"); } } header("Location: index.php");