Use php to customize the 404 error page and send it to the Administrator's Program-PHP source code

Source: Internet
Author: User
Ec (2); if your user cannot find the page he wants, how can he give him a friendly reply and you know that this error has occurred? Let's look at the following procedure, is used to customize the 404 error page and send notifications to the network management. --- Teaman Translation & lt ;? Php # Set $ domain to your domain name (note that there is no www) $ domainoso.com.cn; # Set the URL, note that there is no trailing line $ docroot script ec (2); script

If your user cannot find the page he wants, how can he give him a friendly reply and you know that this error has occurred? Look at the following program, is used to customize the 404 error page and send notifications to the network management. --- Teaman translation Arrangement
# Set $ domain to your domain name (note that there is no www)
$ Domain = "oso.com.cn ";
# Set the URL. Note that there is no Dash/
$ Docroot = "http://www.oso.com.cn ";
# Set the font of the error message
$ Fontface = "Verdana ";
# Set the font size of the 404 page
$ Fontsize = "2 ";
# Set the background color of the 404 page. The default value is white.
$ Bgcolor = "# ffffff ";
# Set the text color. The default value is black.
$ Textcolor = "#000000 ";
# Use the $ reportlevel variable to control whether to send emails to the network administrator.
#0 = do not send emails at all. Hey, how can teaman go wrong?
#1 = Send a mail only when the page contains your DOMAIN NAME
#2 = even if a disconnected connection occurs with me, it may be a site of friendship.
$ Reportlevel = 2; // This is the safest
$ Emailaddress = "webmaster@oso.com.cn"; // set the mailbox for receiving error messages

Function print_details ()
{
# Request access to the global variables we need
Global $ fontface, $ fontsize, $ docroot, $ REQUEST_URI, $ reportlevel;
Global $ bgcolor, $ textcolor;
# Print the 404 error in web format
Echo" 404 no page found";
Echo"";
Echo" 404 sorry, I did not find the page you requested";
Echo"

";
Echo "osuo Network Management reminds you that the requested page $ docroot $ REQUEST_URI, doesn' t exist ";
Echo "on this server.

";
If ($ reportlevel! = 0)
{
Echo"

";
Echo "the error message has been sent to the osos network administrator .";
}
Return;
}

# EMAIL processing functions
Function send_email ()
{
# Request access to the global variables we need
Global $ REQUEST_URI, $ HTTP_REFERER, $ emailaddress, $ REMOTE_ADDR, $ docroot;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.