1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- date_default_timezone_set("Asia/chongqing");
- error_reporting(E_ERROR);
- header("Content-Type: text/html; charset=utf-8");
- $CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);
- $action = $_GET['action'];
- switch ($action) {
- case 'config':
- $result = json_encode($CONFIG);
- break;
-
- case 'uploadimage':
-
- case 'uploadscrawl':
-
- case 'uploadvideo':
-
- case 'uploadfile':
- $result = include("action_upload.php");
- break;
-
- case 'listimage':
- $result = include("action_list.php");
- break;
-
- case 'listfile':
- $result = include("action_list.php");
- break;
-
- case 'catchimage':
- $result = include("action_crawler.php");
- break;
- default:
- $result = json_encode(array(
- 'state'=> '请求地址出错'
- ));
- break;
- }
- if (isset($_GET["callback"])) {
- if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
- echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
- } else {
- echo json_encode(array(
- 'state'=> 'callback参数不合法'
- ));
- }
- } else {
- echo $result;
- }
|