<?php //$image_link=base_url()."img/instructor/user.png"; //E:/WebApplication/genuity_training/system/../log/log.txt //http://localhost/genuity_training/log/log.txt // $_SERVER['DOCUMENT_ROOT'].'/sites/bestinfo/images/news/CodeCogsEqn.gif'; function log_action($action, $message="") { $logfile = $_SERVER['DOCUMENT_ROOT'].'/genuity_training/log/log.txt'; $new = file_exists($logfile) ? false : true; if($handle = fopen($logfile, 'a')) { // append $timestamp = strftime("%Y-%m-%d %H:%M:%S", time()); $content = "{$timestamp} | {$action}: {$message}\n"; fwrite($handle, $content); fclose($handle); if($new) { chmod($logfile, 0755); } } else { echo "Could not open log file for writing."; } } ?>