//Some times a controller function will add to the pre //existing code. Other times it will require a reload. //Also some functions e.g. add to db and delete db are too //dangerous to leave in someones url bar. $uri = explode("index.php/", $_SERVER['REQUEST_URI'])[1]; //$_SESSION['oldUri'] = $uri; $url = explode("?", $uri)[0]; //echo $url; for ($i = 0; $i < count($ROUTERS); $i++) { include $ROUTERS[$i]; } //Gets the router object. if ($url == "") { //echo "empty"; //echo $router->getDefaultUrl(); $redirect = $router->getDefaultUrl(); //echo $redirect; header("Location: " . $redirect); //Needs to be before includes. //echo "end"; } for ($i = 0; $i < count($MODELS); $i++) { include $MODELS[$i]; } //Gets the controller file. for ($i = 0; $i < count($CONTROLLERS); $i++) { include $CONTROLLERS[$i]; } //Gets the models. $ctrlName = $router->getCtrl($url); //Assigns the controller name.