I have a function forbid()
that is supposed to write to a log file that access was denied, along with a reason for the denial. For some reason, it's not writing to the logfile.
// function to forbid access
function forbid($reason) {
// explain why
if ($reason) fputs($file, "=== ERROR: " . $reason . " ===\n");
fputs($file, "*** ACCESS DENIED ***" . "\n\n\n");
fclose($file);
// forbid
header("HTTP/1.0 403 Forbidden");
exit;
}
$file
is defined earlier in the code, and other fputs()
prior to this function are working correctly; I think it's something about the 403 header causing it to not write.