<?php
######################################################################
######################################################################
### ###
### 404.php Page not found Version 0.95 ###
### Copyright 2001 Eljee Bergwerff prive@eljee.nl ###
### Created 10-2004 Last Modified Today ###
### Scripts Name: 404.php ###
### ###
######################################################################
######################################################################
// This simple script will send you a email when a page hasn't been found on your server. This way you can easely keep track of broken links
// It also emails the refered page where the visitor came from. It will print a error message and will redirect the visitor to another page.
// 1) place this script in the document root of your server.
// 2) create a .htaccess file with the following line: ErrorDocument 404 /404.php
// 3) edit the variables below
// 4) you are done! no broken links that you aren't aware of anymore!
// Enter the company name or site name here
$sitename = "Down-fr.com";
// No need to edit the following, but it will not harm to take a look at it!
-
// Enter the name of the one receiving the error email
$toname = "Webmaster";
-
// Enter the website administrators email address here.
// Replace $_SERVER["SERVER_ADMIN"] with "email@address.com" (including the "") if you want to use a differend email address
$to = $_SERVER["SERVER_ADMIN"];
-
// Enter the FROM email address here. No need to edit this, just incase you want to use a differend one.
$fromemail = "$to";
-
// Enter the subject of the email that will be send out
$subject = "404 Broken Link at $sitename";
-
// Redirect URL (if you use / no matter where on you site the 404 error will take place, you the visitor will always get ridirected to the indexpage.
// Chance this only if you want to redirect the visitor to one place somewhere else. This can be a relative path to a page but also a remote hosted
// page. For exampl, /dir/another_dir/thisone.html or http://www.anotherserver.com are both valid)
// Comment out the following line (like #$url = "/";) if you don't want to redirect.
#$url = "/";
// Amount of seconds it will take before redirecting the user.
$redir_sec = "10";
// Error message to print out
$error_message = "ERROR! 404 -- Page Not Found";
#####################
#print error message
#####################
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title><?=$subject?></title>
<?
if (isset($url)){echo"<meta http-equiv="refresh
" content="$redir_sec;url=
$url">";
}?> </head>
<body>
<p>
<b><?=$error_message;?></b>
</p>
</body>
<html>
<?
#####################
#get server vars
#####################
$referer =
getenv("HTTP_REFERER");
$badpage=($_SERVER["HTTP_HOST"].$_SERVER[REQUEST_URI]);
#####################
#skip common (approved) errors
#####################
if ($_SERVER[REQUEST_URI
] ==
"/robots.txt"){exit;
} if ($_SERVER[REQUEST_URI
] ==
"/favicon.ico"){exit;
}
#####################
#email message
#####################
/* message */
$message .= "
<html><head></head><body bgcolor="#FFFFFF" text="#000000">
<font face="Tahoma" size="2">
<p>Dear Webmaster,<br>
<br>
<TABLE BORDER="0" CELLSPACING="3" CELLPADDING="3">
<TR>
<TD VALIGN="TOP">
<b>Broken
Link Report!</b>:
</TD>
<TD VALIGN="TOP">
<a href="http://$badpage">$badpage</a>
</TD>
</TR>
";
if (!($referer == "")){
$message .= "
<TR>
<TD VALIGN="TOP">
<b>Linked From</b>:</TD>
<TD VALIGN="TOP">
<a href="http://$referer">$referer</a>
</TD>
</TR>
-
";
}
$message .= "
</TABLE>
<br>
Regards, webbot<br>
</p>
</font></body></html>
";
/* set header. */
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "To: $toname <$to>rn";
$headers .= "From: $sitename <$fromemail>rn";
/* and now mail it */
@mail($to, $subject, $message, $headers);
exit;
?>