1<?php /* MONITOR PLUGIN HEARTBEAT TICKER SCRIPT */ 2 3/* build the resulting log line (ensure fixed column positions!) */ 4$logArr = Array( 5 intval($_GET['t']), /* timestamp */ 6 $_GET['p'] ?? null, /* page ID */ 7 $_SERVER['REMOTE_ADDR'] ?? 'null', /* remote IP */ 8 $_COOKIE['DokuWiki'] ?? 'null', /* DokuWiki session ID */ 9 $_GET['t'] ?? null /* client time */ 10); 11 12/* create the log line */ 13$filename = 'logs/' . gmdate('Y-m-d') . ".tck"; /* use GMT date for filename */ 14$line = gmdate('Y-m-d H:i:s'); /* use GMT time for log entries */ 15foreach ($logArr as $val) { 16 $line .= "\t" . $val; 17}; 18 19/* write the log line to the file */ 20$tickfile = fopen($filename, "a"); 21if (!$tickfile) { 22 http_response_code(500); 23 die("Error: Unable to open log file. Please check file permissions."); 24} 25if (fwrite($tickfile, $line . "\n") === false) { 26 http_response_code(500); 27 fclose($tickfile); 28 die("Error: Could not write to log file."); 29} 30fclose($tickfile); 31 32/* Send "Accepted" header */ 33http_response_code(202); 34echo "OK";