12345678910111213141516171819202122232425262728293031 |
- <?php
- class LogFile {
- public function append($filename, $message) {
- $fileHandle = null;
- if(!file_exists(LOG_PATH . $filename)) {
- $fileHandle = fopen(LOG_PATH . $filename, 'w');
- $message .= "\n";
- } else {
- $fileHandle = fopen(LOG_PATH . $filename, "a");
- $message .= "\n";
- }
- fwrite($fileHandle, $message);
- fclose($fileHandle);
- }
- public function outputHTML($filename) {
- $output = "";
- $fileHandle = fopen(LOG_PATH . $filename, "r");
- while(!feof($fileHandle)) {
- $line = fgets($fileHandle);
- if($line == "") {
- continue;
- }
- $output = "<tr><td>" . $line . "</td></tr>\n" . $output;
- }
- fclose($fileHandle);
- return $output;
- }
- }
|