Vois ma page d'erreur, un peu longuet mais documenté (ce n'est pas de moi, ai juste personnalisé l'affichage bilingue :
<?
# 404.php - Last updated 3/1/2002, initially released 8/10/2000
# Trap 404 errors and mail a notice to the webmaster
# Now requires PHP4
# Copyright 2000-2002 shaun@shat.net under the GPL v2+
# Set these variables to configure the script:
# Set $domain to your domain name (no www)
$domain = "animated-gifs.eu";
# Set $docroot to the URL of the directory which contains your
# .htaccess file. Don't include trailing slash.
$docroot = "http://www.animated-gifs.eu";
# 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
# 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.
# You can leave this unassigned if you're not using email features.
$emailaddress = "claude.chamagne@orange.fr";
#
#Configuration ends here!
#
#Until I rewrite my scripts, this will suffice for bg-compatibility;
if(phpversion() >= "4.2.0"){
extract($_POST);
extract($_SERVER);
extract($_ENV);
}
# The print_details function is what prints the 404 error to
# the visitor.
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 <<<EOT
<html><head><title>404 Not Found</title></head>
<body bgcolor="$bgcolor" text="$textcolor">
<p align="center"><img src="http://www.animated-gifs.eu/uk.gif" width="29" height="20" border="0"><br>
<font face="$fontface" size="5"><b>Page Not Found</b></p>
<p align="center"><font face="$fontface" size="$fontsize">We're sorry. The page you requested, $docroot$REQUEST_URI, doesn't exist.</font></p>
<p align="center"><a href="http://www.animated-gifs.eu/index.html"><b>Go back to Home Page</b></a></p>
<p align="center"><font face="$fontface" size="$fontsize">The details of this error have automatically been mailed to the webmaster.</font></p>
<hr>
<p align="center"><img src="http://www.animated-gifs.eu/fr.gif" width="29" height="20" border="0"><br>
<font face="$fontface" size="5"><b>Page Non Trouvée</b></p>
<p align="center"><font face="$fontface" size="$fontsize">Désolé, la page $docroot$REQUEST_URI n'existe pas.</font></p>
<p align="center"><a href="http://www.animated-gifs.eu/index-fr.html"><b>Retour à la Page d'Accueil</b></a></p>
<p align="center"><font face="$fontface" size="$fontsize">Les détails concernant cette erreur ont été envoyées automatiquement au webmestre.</font></p>
EOT;
return;
}
# The send_email function sends the details of the 404 error to the
# webmaster.
function send_email(){
# Request access to the global variables we need
global $REQUEST_URI, $HTTP_REFERER, $emailaddress, $REMOTE_ADDR, $docroot;
# Build the $errortime variable to contain the date/time of the error.
$errortime = (date("d M Y h:m:s"));
# Create the body of the email message
$message .= "Erreur sur http://www.animated-gifs.eu\n";
$message .= "A 404 error was encountered by $REMOTE_ADDR";
$message .= " on $errortime.\n\n";
$message .= "The URL 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!
$headers = "From: $emailaddress\nDate: $errortime -0600\n";
$subject = "Erreur sur ANIMATED-GIFS";
mail($emailaddress, $subject, $message, $headers);
return;
}
# Done with function declarations. Main function begins here.
header("404 Not Found");
# 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();
# Close up the HTML tags
echo "</body></html>";
?>
Et pour voir ce que ça donne voir
http://www.animated-gifs.eu/adresse-bidon
(valable juste ce weekend, je suspendrai le contrôle ensuite)