php being accessed several times a day, I don't know why.

email is being sent from a php file and it should not be

Page 1 of 1

2 Replies - 787 Views - Last Post: 08 September 2009 - 03:29 PM Rate Topic: -----

#1 lilmike  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 01-February 09

php being accessed several times a day, I don't know why.

Posted 07 September 2009 - 10:02 AM

Hi all,
I have an error page that is in php, and it generates dynamic content depending on what page is requested.
It also sends email to me when an error was requested.
I am getting this error message in the mail about 5-10 times a day:

Quote

The following error has been received on Saturday 05th 2009f September 2009 20:50:20

Error 404 - Page Not Found
Requested URL: /errors/error.php?error=404
Referring URL:

IP Address: 72.30.65.58



As far as I can tell, this is a yahoo crawler.
I banned all crawlers from accessing /errors/ but it didn't seem to help.

here is my robots.txt file:

Quote

User-agent: *
Disallow: /errors/

here is my php file:

<html>
<head>
<meta name="robots" content="noindex, nofollow">
<title>A website error has occurred</title>
</head>
<body>
<?php
/*
Dynamic Error Pages v1.02

Copyright (c) 2004 Sabre Web Design <http://www.sabrewebdesign.com/>
All rights reserved.

If you like this script, we would appreciate a link back to Sabre Web Design <www.sabrewebdesign.com>.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Redistributions of this script is free for Non-Commercial use ONLY!
* Neither the name of Sabre Web Design nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

HOW TO INSTALL THE SCRIPT:
* Copy and paste this whole script into your page where you would like your error to be displayed.
* Change the "error@example.com" e-mail below to your e-mail address.
* Add the following lines to your .htaccess file (change the location of your error page, if needed):
ErrorDocument 400 /errorpages/errorpage.php?error=400
ErrorDocument 401 /errorpages/errorpage.php?error=401
ErrorDocument 403 /errorpages/errorpage.php?error=403
ErrorDocument 404 /errorpages/errorpage.php?error=404
ErrorDocument 500 /errorpages/errorpage.php?error=500
* And it's as simple as that!

*/

//Find error code
$error=$_GET['error'];

//E-mail to be used for errors (Change this to your email address)
$email = "xxx@xxx.xxx";

//Find reffering and requested URLs
$referring_url = $_SERVER['HTTP_REFERER'];
$requested_url = $_SERVER["REQUEST_URI"];

//Different error messages to display
switch ($_REQUEST['error']) {

//Error 400 - Bad Request
case 400:
$errorname = "Error 400 - Bad Request";
$errordesc = "<h1>Error 400, Bad Request</h1><BR>
Error 400<BR>
<BR>
The URL that you requested was a bad request. <BR>
<BR>
If this problem persists please report it by sending an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.";
break;

//Error 401 - Authorization Required
case 401:
$errorname = "Error 401 - Authorization Required";
$errordesc = "<h1>Error 401, Authorization Required</h1><BR>
Error 401<BR>
<BR>
The URL that you requested may need a password to access.<BR>
<BR>
If you would like to pertain a password then please send an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.<BR>";
break;

//Error 403 - Access Forbidden
case 403:
$errorname = "Error 403 - Access Forbidden";
$errordesc = "<h1>Error 403, Access Forbidden</h1><BR>
<BR>
Access to the URL that you requested is forbidden.<BR>
<BR>
If this problem persists please report it by sending an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.<BR>
<br>
Also note that if the problem is not fixed in a reasonable amount of time, then you might not be allowed to access this directory.";
break;

//Error 404 - Page Not Found
case 404:
$errorname = "Error 404 - Page Not Found";
$errordesc = "<h1>Error 404, Page Not Found</h1><BR>
<BR>
We're sorry but the page you are looking for cannot be found.<BR>
<BR>
If this problem persists please report it by sending an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.<BR>";
break;

//Error 500 - Server Configuration Error
case 500:
$errorname = "Error 500 - Server Configuration Error";
$errordesc = "<h1>Error 500, Server Configuration Error</h1><BR>
<BR>
The URL that you requested resulted in a server configuration error.
It is possible that the condition causing the problem will be gone by
the time you finish reading this. <BR>
<BR>
If this problem persists please report it by sending an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.<BR>";
break;

//Unknown error
default:
$errorname = "Unknown Error";
$errordesc = "<h1>Unknown Error</h1><BR>
The URL that you requested resulted in an unknown error.
It is possible that the condition causing the problem will be gone by
the time you finish reading this. <BR>
<BR>
If this problem persists please report it by sending an e-mail to <A href=\"mailto:".$email."\">".$email."</A>,
mentioning the error message received and the page you were trying to
reach. We are sorry for any inconvenience caused and we will do all we
can to fix the error as soon as possible.<BR>";

}

//Display selected error message
echo($errordesc);
if($referring_url != "") // for if the url was not there, maybe this doesn't work.
{
echo("<br>Click <a href=\"".$referring_url."\">this link</a> to go back.");
}


//E-mail error to your e-mail address (If you do not wish to receive emails delete the following paragraph)
$datetime = date("l dS of F Y H:i:s");
$message = "<i>The following error has been received on "."$datetime\n</i><br>\n<br>\n";
$message .= "<b><i>$errorname</i></b><br>\n";
$message .= "<i>Requested URL:</i> " . $requested_url . "\n<br><i>Referring URL:</i> " . $referring_url;
$message .= "\n<br><br><i>IP Address:</i> ".$_SERVER['REMOTE_ADDR'];

$to = "$email";
$subject = "Web Site Error";
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to,$subject,$message,$headers);
//End of E-mail sender
?>
</body>
</html>



Any help would be appreciated.
Thanks,
-Lilmike.

Is This A Good Question/Topic? 0
  • +

Replies To: php being accessed several times a day, I don't know why.

#2 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: php being accessed several times a day, I don't know why.

Posted 07 September 2009 - 12:11 PM

Hmm, never dealt with this but is this the only IP address that comes up?

This post has been edited by musya: 07 September 2009 - 12:11 PM

Was This Post Helpful? 0
  • +
  • -

#3 garfinkle  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 27
  • View blog
  • Posts: 87
  • Joined: 08-September 09

Re: php being accessed several times a day, I don't know why.

Posted 08 September 2009 - 03:29 PM

There must be a broken link someone on your site that is triggering the 404 error.

Run your site through the audit my PC site map generator at http://www.auditmypc...xml-sitemap.asp

It will analyse ever link it can find and list any that are causing 404 errors.

You can then elimate the 404'd links and the e-mails should stop (hopefully)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1