function authenticateapp(\Slim\Route $route) { // Getting request headers $headers = apache_request_headers(); $response = array(); $app = \Slim\Slim::getInstance(); // Verifying Authorization Header if (isset($headers['Authorization'])) { $db = new apps(); // get the app key $app_key = $headers['Authorization']; // validating app key if (!$db->isValidAppKey($app_key)) { // app key is not present in applications table echo json_encode(array('error' => true, 'message' => 'Acceso Denegado. App key Invalida')); $app->stop(); } else { global $app_id; // get app primary key id $app = $db->getAppId($app_key); if ($app != NULL) { $app_id = $app; } } } else { // app key is missing in header echo json_encode(array('error' => true, 'message' => 'Falta App key')); $app->stop(); } }