���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/api-truyentranh/ |
<?php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *");//quan trong, cho phep nhung header linh tinh khac /*header('Authorization: Bearer ' . $INFO['api_token']);*/ date_default_timezone_set("Asia/Ho_Chi_Minh"); error_reporting(E_ERROR | E_WARNING | E_PARSE); session_start(); define('ROOT_PATH', dirname(__FILE__) . '/'); $INFO['api_token'] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2NTczMzE2ODgsImV4cCI6MTY4ODg2NzY4OCwiYXVkIjoid3d3LmV4YW1wbGUuY29tIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSIsIkdpdmVuTmFtZSI6IkpvaG5ueSIsIlN1cm5hbWUiOiJSb2NrZXQiLCJFbWFpbCI6Impyb2NrZXRAZXhhbXBsZS5jb20iLCJSb2xlIjpbIk1hbmFnZXIiLCJQcm9qZWN0IEFkbWluaXN0cmF0b3IiXX0.3PXXeua7B4UfGhvH4s8QWKCzf5w0M_uGUODs7-wXj_g'; $INFO['host'] = $_SERVER['HTTP_HOST']; $INFO['path_host'] = ''; $INFO['home_url'] = 'https://' . $INFO['host'] . $INFO['path_host'] . '/'; $INFO['app_url'] = getenv('APP_URL'); $INFO['sql_host'] = 'localhost'; $INFO['sql_user'] = 'root'; $INFO['sql_pass'] = 'Gunblade!23'; $INFO['sql_port'] = ''; $INFO['sql_database'] = 'truyentranh'; $INFO['sql_tbl_prefix'] = 'tb_'; $INFO['path_image'] = 'https://truyentranh.thietkewebvumi.com'; $memcache = new Memcache; $memcache->connect('127.0.0.1',11211) or die ("Sorry, could not connect memcached!"); require ROOT_PATH . "includes/class_info.php"; $CORE = new info(); require ROOT_PATH . "includes/class_functions.php"; $func = new FUNC; $CORE->input = $func->get_input(); require ROOT_PATH . "includes/class_display.php"; $print = new display(); require ROOT_PATH . "includes/class_db.php"; $DB = new db_driver; $DB->connect($INFO); require ROOT_PATH . "includes/functions.php"; $arr_header = getRequestHeaders(); if (!isset($arr_header['Guest-Token']) or $arr_header['Guest-Token'] != $INFO['api_token']) { $arr = array( "status" => false, "status_note" => "Guest token key not right!", ); echo json_encode($arr); exit(); } $lang='vi'; if(isset($arr_header['Accept-Language']) and $arr_header['Accept-Language']=='en'){ $lang='en'; } /*$token = get_bearer_token(); $r_user_token = $DB->fetch_row($DB->query("SELECT * FROM TB_USER WHERE remember_token='$token'")); if(!$r_user_token) { $arr=array( "status" => false, "status_note" => "User token key not found!", ); echo json_encode($arr); exit(); }*/ //begin api show $method = $_SERVER['REQUEST_METHOD']; $act = isset($CORE->input['act']) ? $CORE->input['act'] : ''; switch ($method) { case 'GET': if ($act != '') { if (file_exists(ROOT_PATH . 'includes/get/' . $act . '.php')) { require ROOT_PATH . 'includes/get/' . $act . '.php'; } else { require ROOT_PATH . 'includes/404.php'; } } else { require ROOT_PATH . 'includes/404.php'; } break; case 'POST': if ($act != '') { if (file_exists(ROOT_PATH . 'includes/post/' . $act . '.php')) { require ROOT_PATH . 'includes/post/' . $act . '.php'; } else { require ROOT_PATH . 'includes/404.php'; } } else { require ROOT_PATH . 'includes/404.php'; } break; case 'DELETE': if ($act != '') { if (file_exists(ROOT_PATH . 'includes/delete/' . $act . '.php')) { require ROOT_PATH . 'includes/delete/' . $act . '.php'; } else { require ROOT_PATH . 'includes/404.php'; } } else { require ROOT_PATH . 'includes/404.php'; } break; } $DB->free_result(); $DB->close_db(); function get_authorization_header() { $headers = null; if (isset($_SERVER['Authorization'])) { $headers = trim($_SERVER["Authorization"]); } else if (isset($_SERVER['HTTP_AUTHORIZATION'])) { //Nginx or fast CGI $headers = trim($_SERVER["HTTP_AUTHORIZATION"]); } else if (function_exists('apache_request_headers')) { $requestHeaders = apache_request_headers(); // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization) $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders)); //print_r($requestHeaders); if (isset($requestHeaders['Authorization'])) { $headers = trim($requestHeaders['Authorization']); } } return $headers; } function get_bearer_token() { $headers = get_authorization_header(); // HEADER: Get the access token from the header if (!empty($headers)) { if (preg_match('/Bearer\s(\S+)/', $headers, $matches)) { return $matches[1]; } } return null; } function getRequestHeaders() { $headers = array(); foreach ($_SERVER as $key => $value) { if (substr($key, 0, 5) <> 'HTTP_') { continue; } $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5))))); $headers[$header] = $value; } return $headers; } ?>