log_email("email to: " . $to . " at: " . $time);
}
function log_email($message){
$dir = dirname(__FILE__);
$filename = $dir . "/logs/email_log.txt";
echo $filename;
if(is_readable($filename)){
$handle = fopen($filename, "w+");
$contents = fread($handle, filesize($filename));
fwrite($handle, $message . "
" . $contents);
fclose($handle);
}else{
echo 'The file is not readable.';
}
}
The file has 777 access, the file contains some text. I get a warning up saying: Warning: fread(): Length parameter must be greater than 0 in ...
$contents variable ends up containing nothing? Any ideas? The directory must be correct because if i delete the file, my is_readable returns false.