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(); } }
<?php apps::demo_item('Gaming', '8bitNerd', true, 'Free', 'gamepad', '#ffeB3b'); ?> </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <?php apps::demo_item('Science', '8bitNerd', true, 'Free', 'flask', '#795548'); ?> </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <?php apps::demo_item('Tech', '8bitNerd', true, 'Free', 'laptop', '#9e9e9e'); ?> </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <?php apps::demo_item('Nerd Dating', '8bitNerd', true, '$4.99', 'heart', '#f44336'); ?> </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> <?php apps::demo_item('Finance', '8bitNerd', true, '$9.99', 'money', '#8bc34a'); ?> </div> </div> </div> <script src="../js/jquery-1.12.0.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/materialize.min.js"></script> </body> </html>
<?php $do = new apps(); $do->process(); class apps { function __construct() { date_default_timezone_set('America/Chicago'); error_reporting(E_ALL); ini_set('display_errors', false); } function process() { // parse the querystring // if username and password are set, process, otherwise generate an error // query the database to see which publications the subscrber has access to // return the list of publications, or an appropriate error message, e.g., subscription expired // $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); isset($_SERVER['QUERY_STRING']) ? parse_str($_SERVER['QUERY_STRING'], $querystring) : ($querystring = array()); // $_COOKIE['pubs'] = "ten"; // $_COOKIE['perm'] = "KO"; $rsspath = ''; if (isset($_POST['usr']) && isset($_POST['pwd'])) { isset($_POST['device']) ? $device = $_POST['device'] : ($device = ''); $params['0'] = array($_POST['usr'], $_POST['pwd']); if (isset($querystring['do']) && $querystring['do'] == "0") { echo $this->getEntitlements($params); } else { echo $this->respondToSender($this->getEntitlements($params)); }