function print_log($log, $dir){ $dir = realpath(dirname($_SERVER['PATH_TRANSLATED'])."/".$dir)."/"; $log.="\n"; $date = date ('Ymd His'); $day = substr($date, 0, 8); $fp = fopen($dir.$day,"a"); if($fp){ fputs($fp, "$date\t$log"); fclose($fp); } else { //echo "Erro na gravacao do arquivo de log\n\n"; } }