+ Reply to Thread
Results 1 to 5 of 5

Thread: Error pages - send me info (read further for clarification)

  1. #1
    dwd2000's Avatar
    dwd2000 is offline x10 Sophmore dwd2000 is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Left of Toronto.
    Posts
    161

    Question Error pages - send me info (read further for clarification)

    Note: I'm a paying customer, so yes, I can edit my error pages.

    Scenario:
    Someone happens to land on an error page, for whatever reason. I would like the info automatically sent to me without the user knowing.

    cPanel has the codes already available to insert into the error pages, but I would like to know what's happening. If someone is getting an error page by clicking a bad link, or a hacker trying to search for something and getting the error pages, I would like to know. I can check the e-mails to see if the same person is getting a lot of error pages, or just to fix a link.

    I was thinking of incorporating a form into the page, and maybe using a "refresh"/"redirect" meta tag to get them to an html page with the same info as the original error page. As the page refreshes, the e-mail is being sent to me without the user knowing or having a chance to react or depending on him/her to actually click a "submit" button.

    Any ideas???

    Thirty years ago I was young and foolish.
    Now, I'm just young.


  2. #2
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: Error pages - send me info (read further for clarification)

    Well, you can use php code in your errorpage to send the mail automaticly when somebody sees the page. But php won't be able to determine it's a hacker or just a wrong link...
    This would be an example of a 404 page:
    PHP Code:
    <?php
    //The difference in time between you and the server. (in seconds)
    $timezoneoffset 0;
    //Your emailadress
    $yourmail "you@host.com";
    $requested $_SERVER['HTTP_REFERRER'];
    $ip $_SERVER['REMOTE_ADDR'];
    //Internet host name, gives some more info (isp and usually a hint of his location)
    $ihn gethostbyaddr($ip);
    $time time() + $timezoneoffset;
    $date date("Y-m-d at h:i"$time);
    $mail "<html><body>$ip ($ihn)<br>Requested the non-existing page <i>$requested</i>.<br>Time: $date<body></html>";
    $headers "From: 404 <{$_SERVER['SERVER_ADMIN']}>\r\n";
    $headers .= "Content-type: text/html\r\n";
    //@ makes it silent, no errors on failure
    @mail($yourmail"404 error"$mail$headers);
    ?>
    <html>
    <head>
    <title>404</title>
    </head>
    <body>
    A HTTP 404 error has occured.
    </body>
    </html>
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  3. #3
    dwd2000's Avatar
    dwd2000 is offline x10 Sophmore dwd2000 is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Left of Toronto.
    Posts
    161

    Re: Error pages - send me info (read further for clarification)

    Quote Originally Posted by marshian View Post
    Well, you can use php code in your error page to send the mail automatically when somebody sees the page. But php won't be able to determine it's a hacker or just a wrong link...
    I'm not worried about the code determining if it's a hacker. I can probably figure that out by the pages they are trying to get to and how many times they try.

    Wouldn't I have to change the error pages to .php?

    I'm using a nice form script that hides my e-mail address really well. ( Simple PHP Form Mailer http://www.onetforum.com/formmailer/) I'm hoping to find a way for a form to be sent automatically, without the "submit" button.

    I will try your suggestion. Thanks.

    Thirty years ago I was young and foolish.
    Now, I'm just young.


  4. #4
    bass5098 is offline x10Hosting Member bass5098 is an unknown quantity at this point
    Join Date
    Jun 2008
    Posts
    38

    Re: Error pages - send me info (read further for clarification)

    You can make your own .php files and use .htaccess to determine what file to use for the error pages.

  5. #5
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: Error pages - send me info (read further for clarification)

    Yes, the syntax to do this with .htaccess files is: ErrorDocument statuscode file
    example:
    ErrorDocument 403 /err/403.php
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

+ Reply to Thread

Similar Threads

  1. Account Suspened? Please Read My INFO
    By nexus123 in forum Free Hosting
    Replies: 1
    Last Post: 04-02-2008, 04:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers