2 header('X-ServiceWorker-ServerHeader: SetInTheServer');
3 if (isset($_GET['ACAOrigin'])) {
4 $origins = explode(',', $_GET['ACAOrigin']);
5 for ($i = 0; $i < sizeof($origins); ++$i)
6 header("Access-Control-Allow-Origin: " . $origins[$i], false);
9 if (isset($_GET['ACAHeaders']))
10 header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}");
11 if (isset($_GET['ACAMethods']))
12 header("Access-Control-Allow-Methods: {$_GET['ACAMethods']}");
13 if (isset($_GET['ACACredentials']))
14 header("Access-Control-Allow-Credentials: {$_GET['ACACredentials']}");
15 if (isset($_GET['ACEHeaders']))
16 header("Access-Control-Expose-Headers: {$_GET['ACEHeaders']}");
18 if ((isset($_GET['Auth']) and !isset($_SERVER['PHP_AUTH_USER'])) || isset($_GET['AuthFail'])) {
19 header('WWW-Authenticate: Basic realm="Restricted"');
20 header('HTTP/1.0 401 Unauthorized');
21 echo 'Authentication canceled';
25 if (isset($_GET['PNGIMAGE'])) {
26 header('Content-Type: image/png');
28 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1B' .
29 'AACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAhSURBVDhPY3wro/KfgQLABKXJBqMG' .
30 'jBoAAqMGDLwBDAwAEsoCTFWunmQAAAAASUVORK5CYII=');
34 $username = 'undefined';
35 $password = 'undefined';
36 $cookie = 'undefined';
37 if (isset($_SERVER['PHP_AUTH_USER'])) {
38 $username = $_SERVER['PHP_AUTH_USER'];
40 if (isset($_SERVER['PHP_AUTH_PW'])) {
41 $password = $_SERVER['PHP_AUTH_PW'];
43 if (isset($_COOKIE['cookie'])) {
44 $cookie = $_COOKIE['cookie'];
48 foreach ($_FILES as $key => $file) {
50 $fp = fopen($file['tmp_name'], 'r');
52 $content = $file['size'] > 0 ? fread($fp, $file['size']) : '';
55 $files[] = array('key' => $key,
56 'name' => $file['name'],
57 'type' => $file['type'],
58 'error' => $file['error'],
59 'size' => $file['size'],
60 'content' => $content);
63 header('Content-Type: application/json');
64 $arr = array('jsonpResult' => 'success',
65 'method' => $_SERVER['REQUEST_METHOD'],
66 'headers' => getallheaders(),
67 'body' => file_get_contents('php://input'),
71 'username' => $username,
72 'password' => $password,
74 $json = json_encode($arr);
75 echo "report( $json );";