OLD | NEW |
1 <?php | 1 <?php |
2 header('X-ServiceWorker-ServerHeader: SetInTheServer'); | 2 header('X-ServiceWorker-ServerHeader: SetInTheServer'); |
3 if (isset($_GET['ACAOrigin'])) { | 3 if (isset($_GET['ACAOrigin'])) { |
4 $origins = explode(',', $_GET['ACAOrigin']); | 4 $origins = explode(',', $_GET['ACAOrigin']); |
5 for ($i = 0; $i < sizeof($origins); ++$i) | 5 for ($i = 0; $i < sizeof($origins); ++$i) |
6 header("Access-Control-Allow-Origin: " . $origins[$i], false); | 6 header("Access-Control-Allow-Origin: " . $origins[$i], false); |
7 } | 7 } |
8 | 8 |
9 if (isset($_GET['ACAHeaders'])) | 9 if (isset($_GET['ACAHeaders'])) |
10 header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}"); | 10 header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}"); |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (isset($_SERVER['PHP_AUTH_USER'])) { | 37 if (isset($_SERVER['PHP_AUTH_USER'])) { |
38 $username = $_SERVER['PHP_AUTH_USER']; | 38 $username = $_SERVER['PHP_AUTH_USER']; |
39 } | 39 } |
40 if (isset($_SERVER['PHP_AUTH_PW'])) { | 40 if (isset($_SERVER['PHP_AUTH_PW'])) { |
41 $password = $_SERVER['PHP_AUTH_PW']; | 41 $password = $_SERVER['PHP_AUTH_PW']; |
42 } | 42 } |
43 if (isset($_COOKIE['cookie'])) { | 43 if (isset($_COOKIE['cookie'])) { |
44 $cookie = $_COOKIE['cookie']; | 44 $cookie = $_COOKIE['cookie']; |
45 } | 45 } |
46 | 46 |
| 47 $files = array(); |
| 48 foreach ($_FILES as $key => $file) { |
| 49 $content = ''; |
| 50 $fp = fopen($file['tmp_name'], 'r'); |
| 51 if ($fp) { |
| 52 $content = $file['size'] > 0 ? fread($fp, $file['size']) : ''; |
| 53 fclose($fp); |
| 54 } |
| 55 $files[] = array('key' => $key, |
| 56 'name' => $file['name'], |
| 57 'type' => $file['type'], |
| 58 'error' => $file['error'], |
| 59 'size' => $file['size'], |
| 60 'content' => $content); |
| 61 } |
| 62 |
47 header('Content-Type: application/json'); | 63 header('Content-Type: application/json'); |
48 $arr = array('jsonpResult' => 'success', | 64 $arr = array('jsonpResult' => 'success', |
49 'method' => $_SERVER['REQUEST_METHOD'], | 65 'method' => $_SERVER['REQUEST_METHOD'], |
50 'headers' => getallheaders(), | 66 'headers' => getallheaders(), |
| 67 'body' => file_get_contents('php://input'), |
| 68 'files' => $files, |
| 69 'get' => $_GET, |
| 70 'post' => $_POST, |
51 'username' => $username, | 71 'username' => $username, |
52 'password' => $password, | 72 'password' => $password, |
53 'cookie' => $cookie); | 73 'cookie' => $cookie); |
54 $json = json_encode($arr); | 74 $json = json_encode($arr); |
55 echo "report( $json );"; | 75 echo "report( $json );"; |
56 ?> | 76 ?> |
OLD | NEW |