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

时间:2010-01-14 09:53:03   来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:bsp;# Copyright 2000 shaun@shat.net under the GNU Public License.   # Disclaimer: I wrote this script for me, and it works for me.   # If it doesn't work for you, or makes your server explode,   # that's life. Please email with questions or bug reports.      # Set these variables...
  正文:

<?
  # 404.PHP, 8/10/2000.
  # Traphotoshop/ target=_blank class=infotextkey>ps 404 errors and mails a notice to the Webmaster.
  # Requires PHP 3.0 or newer, and mail capability on your system.
  #
  # Copyright 2000 shaun@shat.net under the GNU Public License.
  # Disclaimer: I wrote this script for me, and it works for me.
  # If it doesn't work for you, or makes your server explode,
  # that's life. Please email with questions or bug reports.
  
  # Set these variables to configure the script:
  
  # Set $domain to your domain name (no www)
  
  $domain = "your.domain.com";
  
  # Set $docroot to the URL of the directory which contains your
  # .htAccess file. Don't include trailing slash.
  
  $docroot = "http://your.domain.com";
  
  # Font face you'd like to use on the 404 page
  
  $fontface = "Verdana";
  
  # Font size you'd like to use on the 404 page
  
  $fontsize = "2";
  
  # Background color of the 404 page (default is white)
  
  $bgcolor = "#ffffff";
  
  # Text color you'd like to use on the 404 page (default is black)
  
  $textcolor = "#000000";
  
  # This script is capable of mailing the details of each 404 error
  # to the webmaster. Use the $reportlevel variable to control when
  # you receive these reports.
  #
  # 0 = don't use the email capabilities at all
  # 1 = send email only if the error's referer contains your domain name
  # (i.e. the 404 was generated by a broken link on your site)
  # 2 = send email any time a 404 error is generated (useful for tracking
  # broken links at other sites which link to you)
  
  $reportlevel = 2;
  
  # Set $emailaddress to the email address of whoever should be
  # notified of 404 errors. Don't escape the @ symbol. This will also
  # be used as the "from" address on any emails the script generates.
  # You can leave this unassigned if you're not using email features.
  
  $emailaddress = "you@your.domain.com";
  
  
  
  ################################################################
  # DON'T EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING #
  ################################################################
  # If you want to edit the script, I've commented profusely :) #
  ################################################################
  
  
  
  # The print_details function is what prints the 404 error to
  # the visitor. As far as I know, PHP3 doesn't incorporate Perl's
  # print <<"EOT" ability. PHP4 does allow this capability
  # but the script was written for PHP3. So, you have to use
  # a lot of echo statements if you want to retain PHP3 compat.
  
  function print_details()
  {
  # Request access to the global variables we need
  global $fontface, $fontsize, $docroot, $REQUEST_URI, $reportlevel;
来源:http://www.002pc.com/master/College/Programming/PHP/11828.html

收藏到:

关于《PHP:404错误陷阱并email给管理员的程序》文章的评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

随机文章

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by rand() limit 10

顶出来的热门

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by diggtop desc,id desc limit 10
站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td