public function display_view($message) { // Grabs the URI and breaks it apart in case we have querystring stuff $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2); //Root if ($request_uri[0] === '/public_html/') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { require '../App/Views/goals.php'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { GoalController::add_goal(); } } //Goals if ($request_uri[0] === '/public_html/goals') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { require '../App/Views/goals.php'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { GoalController::add_goal(); } } if ($request_uri[0] === '/public_html/goals/json') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { header('Location: /public_html/json_goals.php'); } } if ($request_uri[0] === '/public_html/goal') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { require '../App/Views/goal.php'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { GoalController::update_goal_by_id(); } } //Register if ($request_uri[0] === '/public_html/register') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { require '../App/Views/register.php'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { UserController::add_user(); } } //Login if ($request_uri[0] === '/public_html/login') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { require '../App/Views/login.php'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { AuthController::login_user(); } } if ($request_uri[0] === '/public_html/logout') { if ($_SERVER['REQUEST_METHOD'] == 'GET') { AuthController::logout_user(); } } }