Hi, im using the code below on my custom error page, the code is supposed to write the URL of what gave the error page to a file that i can read later, it does this but the page is always the error page itself, anyone know where i gone wrong?
<?php
$logfile = dirname(FILE) . '/404_log';
$handle = @fopen($logfile, 'a');
@fwrite($handle,
"Date: " . date('d-m-Y:H:i:s') . "\n" .
"Page: {$_SERVER['REQUEST_URI']} . \n" .
'Visitor: ' . GetIP() . "\n" .
"\n"
);
@fclose($handle);
function GetIP() {
if (empty($SERVER['HTTP_X_FORWARDED_FOR'])) {
return $SERVER['REMOTE_ADDR'];
} else {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
?>