";
echo "奧索網管提醒您,您要求的頁面 $docroot$REQUEST_URI, doesn't exist";
echo " on this server.
";
以上就介紹了製作404錯誤頁面,並能發信給管理員,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。
echo "錯誤訊息已傳送到奧索網管手中.";
}
return;
}
# EMAIL處理函數
function send_email()
{
# Request access to the global variables we need
global $REQUEST_URI, $HTTP_REFERER, $emailaddress, $REMOTE_ADDR, $docroot;
# 客製化傳送的訊息,如時間地點等.
$today = getdate();
$month = $today[mon];
$mday = $today[mday];
$year = $today[year];
$hours = $today[hours];
$minutes = $today[minutes];
$errortime = "$month/$mday/$year at $hours:$minutes";
# Create the body of the email message
$message .= "404 Error ReportnnA 404 error was encountered by $REMOTE_ADDR";
$message .= " on $errortime.nn";
$message .= "The URI which generated the error is: n$docroot$REQUEST_URInn";
$message .= "The referring page was:n$HTTP_REFERERnn";
# Send the mail message. This assumes mail() will work on your system!
mail("$emailaddress", "404 Error Report", $message, "From: $emailaddress"); //好,把信件發出去
return;
}
# 以下這些是根據變數$reportlevel的設定來寄信與否。
print_details();
# See whether or not we should send an email report. If so, do it.
if ($reportlevel != 0)
if ($reportlevel == 1) {
if (eregi($domain,$HTTP_REFERER))
send_email(); }
else
send_email();
# All done!
exit;
?>