<?php $logContent = '<div style="border:1px solid #FF4500;background-color:#FFDAB9">'; $logContent .= 'Time: '.date("Y-m-d H:i:s")."\r\n"; $logContent .= 'Page: '.$_POST['page']."\r\n"; $logContent .= 'errorMessage:'.$_POST['errorMessage']."\r\n"; $logContent .= 'lineNumber:'.$_POST['lineNumber']."\r\n"; $logContent .= 'User-Agent:'.$_SERVER['HTTP_USER_AGENT']."\r\n"; $logContent .= '</div>'; $logContent = '<pre>'.$logContent.'</pre>'; file_put_contents(date("Y-m-d").'.log.html', $logContent, LOCK_EX | FILE_APPEND);
window.onerror = function(errorMessage, scriptURL, lineNumber) { $.post("write.php", { errorMessage:errorMessage,lineNumber:lineNumber,page:scriptURL}); }