function error()
{
    $app = Slim\Slim::getInstance();
    dbConn::close_connection();
    // Close the connection to the MySQL database
    mongoConn::close_connection();
    // Close the connection to the NoSQL database
    // remove all session variables
    session_unset();
    // destroy the session
    session_destroy();
    // Show the error
    $error = array("error" => "Unauthorised Access. Please Login to use this site.");
    $app->render('../api/resources/error.php', array('myerror' => $error));
}