*/ if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../'); require_once(DOKU_INC . 'inc/init.php'); /* session_start(); $session = json_encode($_SESSION); $cookie = json_encode($_COOKIE); $status = json_encode(session_status()); */ //close session session_write_close(); // default header, ajax call may overwrite it later header('Content-Type: text/html; charset=utf-8'); //call the requested function /* global $INPUT; if ($INPUT->has('call')) { $call = $INPUT->filter([Clean::class, 'stripspecials'])->str('call'); new Ajax($call); } else { http_status(404); }*/ /* $html = "
session
\n"; $html.= "$session\n";
$html.= "cookie
\n"; $html.= "$cookie\n";
$html.= "status
\n"; $html.= "$status\n";
*/
$input = file_get_contents('php://input');
// Unpack
$id = substr($input,0,5);
$md5 = substr($input,5,32);
$text = substr($input,37);
//sleep(5);
// Reject if md5 does not match
if ($md5 != md5($text)) {
http_response_code(400);
die();
}
$info = [];
$html = p_render('xhtml', p_get_instructions($text), $info);
echo $id.md5($html).$html;
//echo json_encode(['input'=>$input]);
//echo json_encode(['session'=>$_SESSION]);