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