OLD | NEW |
(Empty) | |
| 1 <?php |
| 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); |
| 7 } |
| 8 |
| 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']}"); |
| 17 |
| 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'; |
| 22 exit; |
| 23 } |
| 24 |
| 25 $username = 'undefined'; |
| 26 $password = 'undefined'; |
| 27 if (isset($_SERVER['PHP_AUTH_USER'])) { |
| 28 $username = $_SERVER['PHP_AUTH_USER']; |
| 29 } |
| 30 if (isset($_SERVER['PHP_AUTH_PW'])) { |
| 31 $password = $_SERVER['PHP_AUTH_PW']; |
| 32 } |
| 33 |
| 34 header('Content-Type: application/json'); |
| 35 $arr = array('jsonpResult' => 'success', |
| 36 'method' => $_SERVER['REQUEST_METHOD'], |
| 37 'headers' => getallheaders(), |
| 38 'username' => $username, |
| 39 'password' => $password); |
| 40 $json = json_encode($arr); |
| 41 echo "report( $json );"; |
| 42 ?> |
OLD | NEW |