OLD | NEW |
(Empty) | |
| 1 <?php |
| 2 function prettify($name) { |
| 3 return str_replace(' ', '-', ucwords(str_replace('_', ' ', str_replace('http_
', '', strtolower($name))))); |
| 4 } |
| 5 |
| 6 $beaconFilename = "beacon" . (isset($_REQUEST['name']) ? $_REQUEST['name'] : "")
. ".txt"; |
| 7 $beaconFile = fopen($beaconFilename . ".tmp", 'w'); |
| 8 $httpHeaders = $_SERVER; |
| 9 ksort($httpHeaders, SORT_STRING); |
| 10 $contentType = ""; |
| 11 foreach ($httpHeaders as $name => $value) { |
| 12 if ($name === "CONTENT_TYPE" || $name === "HTTP_REFERER" || $name === "REQUE
ST_METHOD" || $name === "HTTP_COOKIE" || $name === "HTTP_ORIGIN") { |
| 13 if ($name === "CONTENT_TYPE") { |
| 14 $contentType = $value; |
| 15 $value = preg_replace('/boundary=.*$/', '', $value); |
| 16 } |
| 17 $headerName = prettify($name); |
| 18 fwrite($beaconFile, "$headerName: $value\n"); |
| 19 } |
| 20 } |
| 21 $postdata = file_get_contents("php://input"); |
| 22 if (strlen($postdata) == 0) |
| 23 $postdata = http_build_query($_POST); |
| 24 |
| 25 fwrite($beaconFile, "Length: " . strlen($postdata) . "\n"); |
| 26 if (strpos($contentType, "application/") !== false) { |
| 27 $postdata = base64_encode($postdata); |
| 28 } |
| 29 |
| 30 fwrite($beaconFile, "Body: $postdata\n"); |
| 31 fclose($beaconFile); |
| 32 rename($beaconFilename . ".tmp", $beaconFilename); |
| 33 foreach ($_COOKIE as $name => $value) |
| 34 setcookie($name, "deleted", time() - 60, "/"); |
| 35 ?> |
OLD | NEW |