AD MANAGEMENT

Collapse

BEHOSTED

Collapse

GOOGLE

Collapse

Dynamic Error Pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic Error Pages

    Dynamic Error Pages


    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 /errorpage.php
    ErrorDocument 401 /errorpage.php
    ErrorDocument 403 /errorpage.php
    ErrorDocument 404 /errorpage.php
    ErrorDocument 500 /errorpage.php
    * And it's as simple as that!


    PHP Code:
    <?php

    */
    Thanx for using this Script.
    */

    // Setup
    $email 'error@example.com';  //Change to your email address

    // Get Variables
    $error $_SERVER['REDIRECT_STATUS'];
    $referring_url $_SERVER['HTTP_REFERER'];
    $requested_url $_SERVER['REQUEST_URI'];
    $referring_ip $_SERVER['REMOTE_ADDR'];
    $server_name $_SERVER['SERVER_NAME'];

    // Different error messages to display
    switch ($error) {

    # Error 400 - Bad Request
    case 400:
    $errorname 'Error 400 - Bad Request';
    $errordesc '<h1>Bad Request</h1>
            <p>Error 400</p>
            <p>
            The URL that you requested, was a bad request.</p>
            <p>
            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.</p>'
    ;
       break;


    # Error 401 - Authorization Required
    case 401:
    $errorname 'Error 401 - Authorization Required';
    $errordesc '<h2>Authorization Required</h2>
            <p>Error 401</p>
            <p>
            The URL that you requested, requires pre-authorization to access.</p>
            <p>
            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.</p>'
    ;
       break;


    # Error 403 - Access Forbidden
    case 403:
    $errorname 'Error 403 - Access Forbidden';
    $errordesc '<h2>Access Forbidden</h2>
            <p>Error 403</p>
            <p>
            Access to the URL that you requested, is forbidden.</p>
            <p>
            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.</p>'
    ;
       break;


    # Error 404 - Page Not Found
    case 404:
    $errorname 'Error 404 - Page Not Found';
    $errordesc '<h2>File Not Found</h2>
            <p>Error 404</p>
            <p>
            We are sorry but the page you are looking for cannot be found.</p>
            <p>
            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.</p>'
    ;
       break;


    # Error 500 - Server Configuration Error
    case 500:
    $errorname 'Error 500 - Server Configuration Error';
    $errordesc '<h2>Server
            Configuration Error</h2>
            <p>Error 500</p>
            <p>
            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. </p>
            <p>
            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.</p>'
    ;
       break;


    # Unknown error
    default:
    $errorname 'Unknown Error';
    $errordesc '<h2>Unknown Error</h2>
            <p>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. </p>
            <p>
            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.</p>'
    ;

    }

    // Display selected error message
    echo($errordesc);
    if (!
    $referring_url == '') {
    echo 
    '<p><a href="'.$referring_url.'"><< Go back to previous page.</a></p>';
    } else {
    echo 
    '<p><a href="javascript:history.go(-1)"><< Go back to previous page.</a></p>';

    echo 
    '<p align="right"><font size="1">Dynamic Error Pages from <a href="http://www.x10hosting.com/" title="x10hosting">Created By o0slowpaul0o</a>.</font></p>';

    // E-mail section. Delete if you do not want to be sent e-mail notifications of errors.
    $datetime date("l dS of F Y - H:i:s");
    $message .= '<i>The following error has been received on '.$datetime.'</i>';
    $message .= '<br><br><b><i>'.$errorname.'</i></b>';
    $message .= '<br><i>Requested URL:</i> <a href="http://'.$server_name.$requested_url.'">'.$requested_url.'</a>';
    $message .= '<br><i>Referring URL:</i> <a href="'.$referring_url.'">'.$referring_url.'</a>';
    $message .= '<br><br><i>IP Address:</i> '.$referring_ip;
    $to "$email";
    $subject "$errorname";
    $headers "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    mail($to,$subject,$message,$headers);
    }
    // End of e-mail section.
    ?>

    http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/7...gorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a>

    Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!!


  • #2
    Re: Dynamic Error Pages

    Thanks for the code

    Comment


    • #3
      Re: Dynamic Error Pages

      thanks for the code, ill install it later!
      Classic Auto's | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
      Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
      Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |

      Comment

      Unconfigured Ad Widget

      Collapse

      Announcement

      Collapse
      1 of 2 < >

      FreeHostForum Rules and Guidelines

      Webmaster forum - Web Hosting Forum,Domain Name Forum, Web Design Forum, Travel Forum,World Forum, VPS Forum, Reseller Hosting Forum, Free Hosting Forum

      Signature

      Board-wide Policies:

      Do not post links (ads) in posts or threads in non advertising forums.

      Forum Rules
      Posts are to be made in the relevant forum. Users are asked to read the forum descriptions before posting.

      Members should post in a way that is respectful of other users. Flaming or abusing users in any way will not be tolerated and will lead to a warning or will be banned.

      Members are asked to respect the copyright of other users, sites, media, etc.

      Spam is not tolerated here in most circumstances. Users posting spam will be banned. The words and links will be censored.

      The moderating, support and other teams reserve the right to edit or remove any post at any time. The determination of what is construed as indecent, vulgar, spam, etc. as noted in these points is up to Team Members and not users.

      Any text links or images contain popups will be removed or changed.

      Signatures
      Signatures may contain up to four lines

      Text in signatures is subject to the same conditions as posts with respect decency, warez, emoticons, etc.

      Font sizes above 3 are not allowed

      Links are permitted in signatures. Such links may be made to non-Freehostforum material, commercial ventures, etc. Links are included within the text and image limits above. Links to offensive sites may be subject to removal.

      You are allowed ONLY ONE picture(banner) upto 120 pixels in width and 60 pixels in height with a maximum 30kB filesize.

      In combination with a banner/picture you can have ONLY ONE LINE text link.


      Advertising
      Webmaster related advertising is allowed in Webmaster Marketplace section only. Free of charge.

      Shopping related (tangible goods) advertising is allowed in Buy Sell Trade section only. Free of charge.

      No advertising allowed except paid stickies in other sections.

      Please make sure that your post is relevant.


      More to come soon....
      2 of 2 < >

      Advertise at FreeHostForum

      We offer competitive rates and a many kinds of advertising opportunities for both small and large scale campaigns.More and more webmasters find advertising at FreeHostForum.com is a useful way to promote their sites and services. That is why we now have many long-term advertisers.

      At here, we also want to thank you all for your support.

      For more details:
      http://www.freehostforum.com/threads...eHostForum-com

      More ad spots:
      http://www.freehostforum.com/forums/...-FreeHostForum
      See more
      See less
      Working...
      X