- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> PHP >> 正文
站内文章搜索:           

PHP:404错误陷阱并email给管理员的程序

作者:佚名    文章来源:网络转载    更新时间 :2007-1-27 1:30:43
EMOTE_ADDR, $docroot;

# Build the $errortime variable to contain the date/time of the error.
# Using date() likely would have been better, but I already had this code
# elsewhere, and I'm lazy.
$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 Report\n\nA 404 error was encountered by $REMOTE_ADDR";
$message .= " on $errortime.\n\n";
$message .= "The URI which generated the error is: \n$docroot$REQUEST_URI\n\n";
$message .= "The referring page was:\n$HTTP_REFERER\n\n";

# Send the mail message. This assumes mail() will work on your system!
mail("$emailaddress", "404 Error Report", $message, "From: $emailaddress");

return;
}


# Done with function declarations. Main function begins here.

# Send a 404 error to the user's browser
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;

?>

上一页  [1] [2] 


发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……