writelog.php
<?php function writeLogFile($event, $message, $data = false) { if(empty($event) || empty($message)) { return false; } $filename = '/home/user/log/' . date('Ym') . '.log'; if(($fd = @fopen($filename, 'a')) === false) { return false; } $ip = Helper::getIP(); fwrite($fd, utf8_encode(sprintf(date('[Y-m-d H:i:s]').' %s [%s] %s'.PHP_EOL), $ip, $event, $message )); fclose($fd); }