$type = $_POST['mimetype'];
$xhr = $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
if ($type == 'xml') {
header('Content-type: text/xml');
?>
A & B
Palmyra
}
else if ($type == 'json') {
// wrap json in a textarea if the request did not come from xhr
if (!$xhr) echo '';
}
else if ($type == 'script') {
// wrap script in a textarea if the request did not come from xhr
if (!$xhr) echo '';
}
else {
// return text var_dump for the html request
echo "VAR DUMP:";
var_dump($_POST);
foreach($_FILES as $file) {
$n = $file['name'];
$s = $file['size'];
if (!$n) continue;
echo "File: $n ($s bytes)";
}
}
?>