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)); }
function postDelete($value) { $app = Slim\Slim::getInstance(); $db = dbConn::getConnection(); $user_details = getAccount($value); $request = $app->request(); $ticket_id = $request->post('ticket_id'); $db_mongo_coll = mongoConn::getConnection(); // remove a ticket with a chosen id $db_mongo_coll->remove(array('_id' => new MongoId($ticket_id)), true); $user_tickets = $db_mongo_coll->find()->sort(array('_id' => -1)); $app->render('../api/resources/view_all_tickets.php', array('user' => $user_details, 'tickets' => $user_tickets)); }
public static function close_connection() { self::$dbmongo = null; }