$login = new PHPLogin(); $action = isset($_GET["action"]) ? $_GET["action"] : ''; $target = isset($_GET["target"]) ? $_GET["target"] : ''; switch ($action) { case 'view_bird': $birdManager = new BirdManager(); $bird = $birdManager->getLast(); include '../views/thank_you.php'; break; case 'add_bird': $birdManager = new BirdManager(); $bird = new Bird(); include '../views/guest_bird_add_edit.php'; break; case 'save_bird': $birdManager = new BirdManager(); $arr = array(); $arr["bid"] = isset($_GET["bid"]) ? $_GET["bid"] : ''; $arr["users_user_id"] = '3'; $arr["date"] = isset($_GET["date"]) ? $_GET["date"] : ''; $arr["species"] = isset($_GET["species"]) ? $_GET["species"] : ''; $arr["eggs"] = isset($_GET["eggs"]) ? $_GET["eggs"] : ''; $arr["nest"] = isset($_GET["nest"]) ? $_GET["nest"] : ''; $arr["distance"] = isset($_GET["distance"]) ? $_GET["distance"] : ''; $arr["migrant"] = isset($_GET["migrant"]) ? $_GET["migrant"] : ''; $arr["sex"] = isset($_GET["sex"]) ? $_GET["sex"] : ''; $bird = new Bird(); $bird->hydrate($arr); $birdManager->save($bird); include '../views/thank_you.php'; break;
$birdManager->_update($bird); header('Location: user.php'); break; case 'save_bird': $birdManager = new BirdManager(); $arr = array(); $arr["bid"] = isset($_GET["bid"]) ? $_GET["bid"] : ''; $arr["users_user_id"] = isset($_GET["userID"]) ? $_GET["userID"] : ''; $arr["date"] = isset($_GET["date"]) ? $_GET["date"] : ''; $arr["species"] = isset($_GET["species"]) ? $_GET["species"] : ''; $arr["eggs"] = isset($_GET["eggs"]) ? $_GET["eggs"] : ''; $arr["nest"] = isset($_GET["nest"]) ? $_GET["nest"] : ''; $arr["distance"] = isset($_GET["distance"]) ? $_GET["distance"] : ''; $arr["migrant"] = isset($_GET["migrant"]) ? $_GET["migrant"] : ''; $arr["sex"] = isset($_GET["sex"]) ? $_GET["sex"] : ''; $arr["users_user_id"] = isset($_GET["users_user_id"]) ? $_GET["users_user_id"] : ''; $bird = new Bird(); $bird->hydrate($arr); $birdManager->save($bird); header('Location: user.php'); break; default: $birdManager = new BirdManager(); $birds = $birdManager->getMyBird($target); include '../views/user_bird_view_list.php'; break; } ?> </body> </html>
$birdManager->_update($bird); header('Location: bird.php'); break; case 'save_bird': $birdManager = new BirdManager(); $arr = array(); $arr["bid"] = isset($_GET["bid"]) ? $_GET["bid"] : ''; $arr["users_user_id"] = isset($_GET["userID"]) ? $_GET["userID"] : ''; $arr["date"] = isset($_GET["date"]) ? $_GET["date"] : ''; $arr["species"] = isset($_GET["species"]) ? $_GET["species"] : ''; $arr["eggs"] = isset($_GET["eggs"]) ? $_GET["eggs"] : ''; $arr["nest"] = isset($_GET["nest"]) ? $_GET["nest"] : ''; $arr["distance"] = isset($_GET["distance"]) ? $_GET["distance"] : ''; $arr["migrant"] = isset($_GET["migrant"]) ? $_GET["migrant"] : ''; $arr["sex"] = isset($_GET["sex"]) ? $_GET["sex"] : ''; $arr["users_user_id"] = isset($_GET["users_user_id"]) ? $_GET["users_user_id"] : ''; $bird = new Bird(); $bird->hydrate($arr); $birdManager->save($bird); header('Location: bird.php'); break; default: $birdManager = new BirdManager(); $birds = $birdManager->getAllBirds($target); include '../views/bird_view_list.php'; break; } ?> </body> </html>