I wanted to create this custom error page and incorporated with my layout. After I ran it to test, I get couple of line errors. can anyone explain what I need to do? I didn’t edited any lines. It was a copy and paste to a new page.
This is the guide I used.
[url]http://www.webreference.com/programming/apache_errors/
The errors I got were
notice: undefine index: HTTP_REFERER in “my dir location” on line 41.
notice: undefined variable: message in “my dir location” on line 131
Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in “my dir location” on line 140
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml "><!-- InstanceBegin template="/Templates/main_template_final.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Duc Su</title>
<!-- InstanceEndEditable -->
<link href="stylesheets/mystylesheet.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<!-- InstanceParam name="homeClass" type="text" value="holder" -->
<!-- InstanceParam name="portfolioClass" type="text" value="holder" -->
<!-- InstanceParam name="aboutClass" type="text" value="holder" -->
<!-- InstanceParam name="eventClass" type="text" value="holder" -->
<!-- InstanceParam name="contactClass" type="text" value="holder" -->
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="logo"></div>
<div id="contactButton"><p><a href="mailto:[email protected] ?subject=Info">contact</a></p></div>
<div id="mainNav">
<ul>
<li><a href="index.htm" class="holder">Home</a></li>
<li><a href="portfolio.htm" class="holder">Portfolio</a></li>
<li><a href="aboutme.htm" class="holder">About Me</a></li>
<li><a href="blog.htm" class="holder">Blog</a></li>
<li><a href="contact.htm" class="holder">Contact</a></li>
</ul>
</div>
<img src="images/header_bg.png" width="760" height="310" alt="ducsu" /></div>
<div id="bgHolder">
<div id="mainContent"><!-- InstanceBeginEditable name="main" --><?php
// Setup
$email = '[email protected] '; //Change to your e-mail 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'];
$subject2 = "IP ONLY";
// Different error messages to display
switch ($error) {
# Error 400 - Bad Request
case 400:
$errorname = 'Error 400 - Bad Request';
$errordesc = '<h1>Bad Request</h1>
<h2>Error Type: 400</h2>
<p>
The URL that you requested — http://'.$server_name.$requested_url.' — does not exist on this server. You might want to re-check the spelling and the path.</p>
<p>
I apologize for any inconvenience caused and will do all I can to fix the error as soon as possible.</p>
<p>You can use the menu at the top of the page or at the right to navigate to another section.</p>';
break;
# Error 401 - Authorization Required
case 401:
$errorname = 'Error 401 - Authorization Required';
$errordesc = '<h1>Authorization Required</h1>
<h2>Error Type: 401</h2>
<p>
The URL that you requested requires pre-authorization to access.</p>
<p>
I will do all I can to fix it as soon as possible.</p>';
break;
# Error 403 - Access Forbidden
case 403:
$errorname = 'Error 403 - Access Forbidden';
$errordesc = '<h1>Access Forbidden</h1>
<h2>Error Type: 403</h2>
<p>
Access to the URL that you requested is forbidden.</p>
<p>
I will do all I can to fix it as soon as possible.</p>';
break;
# Error 404 - Page Not Found
case 404:
$errorname = 'Error 404 - Page Not Found';
$errordesc = '<h1>File Not Found</h1>
<h2>Error Type: 404</h2>
<p>
Ooops! The page you are looking for — http://'.$server_name.$requested_url.' — cannot be found. This may be because:</p>
<ul>
<li>the path to the page was entered wrong;</li>
<li>the page no longer exists; or</li>
<li>there has been an error on the Web site.</li>
</ul>
<p>
I apologize for any inconvenience caused and I will do all I can to fix the error as soon as possible.</p>
<p>You can use the menu at the top of the page navigate to another section.</p>';
break;
# Error 500 - Server Configuration Error
case 500:
$errorname = 'Error 500 - Server Configuration Error';
$errordesc = '<h1>Server Configuration Error</h1>
<h2>Error Type: 500</h2>
<p>
The URL that you requested — <a href="http://'.$server_name.$requested_url.'">http://'.$server_name.$requested_url.'</a> — 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>
I apologize for any inconvenience caused and I will do all I 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 — <a href="http://'.$server_name.$requested_url.'">http://'.$server_name.$requested_url.'</a> — 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> I apologize for any inconvenience caused and I will do all I 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>';
}
// End of e-mail section.
?><!-- InstanceEndEditable --></div>
<div id ="sidebar"><!-- InstanceBeginEditable name="side" --><!-- InstanceEndEditable --></div>
<div id="clear"></div>
</div>
<div id="footer"> <p><a href="index.htm">Home</a> | <a href="portfolio.htm">Portfolio</a> | <a href="aboutme.htm">About Me</a> |<a href="blog.htm"> Blog</a> | <a href="contact.htm">Contact</a></p>
<p style="color: white; font-size: .8em;">Layout designed by Talk-Mania</p>
<p style="color: white; font-size: .8em;">All Rights Reserved. 2010</p>
</div>
</div>
</body>
<!-- InstanceEnd --></html>
[/QUOTE]
ErrorDocument 400 /errorpage.php
ErrorDocument 401 /errorpage.php
ErrorDocument 403 /errorpage.php
ErrorDocument 404 /errorpage.php
ErrorDocument 500 /errorpage.php[/QUOTE]
// Setup
$email = '[email protected] '; //Change to your e-mail 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'];
$subject2 = "IP ONLY";[/QUOTE]
[code=php] echo '<p><a href="javascript:history.go(-1)"><< Go back to previous page.</a></p>';[/code]
// E-mail section. Delete if you do not want to be sent e-mail notifications of errors.
$datetime = date("l, F d, Y - h:i:s A T");
$message .= '<i>The following error was received on '.$datetime.'</i>'; //<---line 133
$message .= '<br><br><b><i>'.$errorname.'</i></b>';
$message .= '<br><i>Requested URL:</i> <a href="http://'.$server_name.$requested_url.'">http://'.$server_name.$requested_url.'</a>';
$message .= '<br><i>Referring URL:</i> <a href="http://'.$referring_url.'">http://'.$referring_url.'</a>';[/QUOTE]
$message .= '<i>The following error was received on '.$datetime.'</i>'; //<---line 133
[/quote]
[code=php]
$message = '<i>The following error was received on '.$datetime.'</i>'; //<---line 133
[/code]
0.1.9 — BETA 5.6