function write($function, $date, $ip, $browser, $status, $desc) { # Check to see if log file is writable. if(!is_writable(LOG_FILE_PATH)) { $this->mess = "Cannot write to log file due to permissions."; } # Open log file to append. if(! $log_handle = fopen(LOG_FILE_PATH, "a+")) { $this->mess = "Failed to open log file for writing"; } # Create the log entry string. $entry = "$function\t$date\t$ip\t$browser\t$status\t$desc\r\n"; # Jump to the top of the logfile for prepending. rewind($log_handle); # Append data to log file. fwrite($log_handle, $entry); # Close log file. fclose($log_handle); return true; }