Jump to content
azer

Custom HTTP Error Page (all version support)

Recommended Posts

Custom HTTP Error Page v1.5

 

- corrected grammatical errors

- corrected wrong link to css

- added a test, if no path given in the admin, by default the log will be

 

written in catalog\log folder using relative path as defined in

 

configure.php rather than hard coded path

- added a french translation ( not finished)

- defined that in admin the default valur would be to write a log and

 

also send the store owner a mail alert

Edited by azer

MS2

Share this post


Link to post
Share on other sites

I love this contribution, but I wish there was a way to not report errors from specific IP addresses. For Example, I use ScanAlert to search my site for Vulnerabilities, and it checks for pages that aren't there, so I get about 1000 HTTP Error e-mails in my box every day! There should be a place to put a list of IP addresses to ignore. If you could help me with this, it'll be greatly appreciated.

 

Thank You,

 

James Black

Share this post


Link to post
Share on other sites

I have everything working fine, well almost. I have turned off email error reporting via the database.

 

I have checked my error log file and there seems to be some information missing:

 

02/05/2007 11:01:41,403,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:51,404,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:55,404,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:57,404,http://www.coolnquiet.co.uk,,,

 

See there is a series of commas at the end of each line that I believe should contain some information.

 

Any Ideas

Thanks

Share this post


Link to post
Share on other sites
I have everything working fine, well almost. I have turned off email error reporting via the database.

 

I have checked my error log file and there seems to be some information missing:

 

02/05/2007 11:01:41,403,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:51,404,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:55,404,http://www.coolnquiet.co.uk,,,

02/05/2007 11:04:57,404,http://www.coolnquiet.co.uk,,,

 

See there is a series of commas at the end of each line that I believe should contain some information.

 

Any Ideas

Thanks

This has just happened to me after migrating to php 5.

 

I think the problem is with the variables in http_error.php around

 

// Send the HTTP Error to Store Owner

if (EMAIL_HTTP_ERROR == 'true') {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT, sprintf(EMAIL_BODY, HTTP_SERVER, $HTTP_GET_VARS['error_id'], $error_text, date("m/d/Y G:i:s"), HTTP_SERVER . $REQUEST_URI, $REMOTE_ADDR, $HTTP_USER_AGENT, $HTTP_REFERER), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

}

 

// Save the HTTP Error Report to disk

 

if (STORE_HTTP_ERROR == 'true') {

// change of 1.5 : check if there is there is a path given in the admin, if not store it ot catalog\log\http_error.log

if (STORE_HTTP_ERROR_LOG !="")

{

error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ',' . $HTTP_GET_VARS['error_id'] . ',' . HTTP_SERVER . $REQUEST_URI . ',' . $REMOTE_ADDR . ',' . $HTTP_USER_AGENT . ',' . $HTTP_REFERER . "\n", 3, STORE_HTTP_ERROR_LOG);

}

else

{

error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ',' . $HTTP_GET_VARS['error_id'] . ',' . HTTP_SERVER . $REQUEST_URI . ',' . $REMOTE_ADDR . ',' . $HTTP_USER_AGENT . ',' . $HTTP_REFERER . "\n", 3, DIR_FS_CATALOG . '/log/http_error.log');

}

}

 

The $HTTP_GET_VARS needs to be changed to $_GET, but I don't know what else to change.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Nevermind, I worked it out.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Nevermind, I worked it out.

 

 

I have installed this, but havent got the log to work, can you provide details please?

 

Thanks


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

 

I have installed this contribution without the error reporting.

 

404 custom error page seems to load fine, but I'm getting two bugs;

 

1) the Search Help java popup page isn't working (whilst still working in the Advanced search page),

 

2) the Date From and Date to fields are auto filled with 'dd/mm/yyyy', however if user

 

a) omits to put proper 'from' and 'to' numerical dates, or

b) delete the prefilled text dates,

 

it gives an Advanced Search error message with 'invalid from date' and 'invalid to date'.

 

If I instead go straight to the Advanced Search page and leave the 'From' and 'to' fields with prefilled 'dd/mm/yyy' text and do a search it does not yield any 'invalid date' messages.

 

Any suggestions on which files I have to edit? I did a keyword search on http_error.php, advanced_search.php, and advanced_search_results.php for the text string dd/mm/yyyy, and also looked around for how it passes them onto other files but no luck.

 

Site is ezpcstart dot com if it will help to have a look.

 

Thank you.


I'm fluent in gibberish. I've been reading gibberish since 1982.

Share this post


Link to post
Share on other sites

Nevermind, I worked it out.

// Send the HTTP Error to Store Owner

if (EMAIL_HTTP_ERROR == 'true') {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT, sprintf(EMAIL_BODY, HTTP_SERVER, $_GET['error_id'], $error_text, date("m/d/Y G:i:s"), HTTP_SERVER . $_SERVER['REQUEST_URI'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_REFERER'], $_SERVER['REMOTE_HOST']), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

}

 

// Save the HTTP Error Report to disk

 

if (STORE_HTTP_ERROR == 'true') {

// change of 1.5 : check if there is there is a path given in the admin, if not store it at catalog\log\http_error.log

if (STORE_HTTP_ERROR_LOG !="")

{

error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ',' . $_GET['error_id'] . ',' . HTTP_SERVER . $_SERVER['REQUEST_URI'] . ',' . $_SERVER['REMOTE_ADDR'] . ',' . $_SERVER['HTTP_USER_AGENT'] . ',' . $_SERVER['HTTP_REFERER'] . ',' . $_SERVER['REMOTE_HOST'] . "\n", 3, STORE_HTTP_ERROR_LOG);

}

else

{

error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ',' . $_GET['error_id'] . ',' . HTTP_SERVER . $_SERVER['REQUEST_URI'] . ',' . $_SERVER['REMOTE_ADDR'] . ',' . $_SERVER['HTTP_USER_AGENT'] . ',' . $_SERVER['HTTP_REFERER'] . ',' . $_SERVER['REMOTE_HOST'] . "\n", 3, DIR_FS_CATALOG . '/log/http_error.log');

}

}


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Happy new year 2010 !

 

I have this recurring error that keeps coming, but I have no link to favicon.ico.

 

An idea?!

 

 

Website: http://www.yoursite.com

Error Code: 404 - 404 - Page Not Found

Appearing: 01/04/2010 18:42:41

Requested URL: http://www.yoursite.com/favicon.ico

Visitor Address: 92,143,208,142

Browser: Mozilla/4.0 (compatible; MSIE 8.0;

Windows NT 6.0; Trident/4.0; SV1;. NET CLR

2.0.50727; Media Center PC 5.0;. NET CLR

3.5.30729;. NET CLR 3.0.30618)

REFERENCE:

Share this post


Link to post
Share on other sites

Happy new year 2010 !

 

I have this recurring error that keeps coming, but I have no link to favicon.ico.

 

An idea?!

 

 

Website: http://www.yoursite.com

Error Code: 404 - 404 - Page Not Found

Appearing: 01/04/2010 18:42:41

Requested URL: http://www.yoursite.com/favicon.ico

Visitor Address: 92,143,208,142

Browser: Mozilla/4.0 (compatible; MSIE 8.0;

Windows NT 6.0; Trident/4.0; SV1;. NET CLR

2.0.50727; Media Center PC 5.0;. NET CLR

3.5.30729;. NET CLR 3.0.30618)

REFERENCE:

 

Pb solved, I made a favicon.ico with GIMP.

Here the source: http://egressive.com/tutorial/creating-a-multi-resolution-favicon-including-transparency-with-the-gimp

Share this post


Link to post
Share on other sites

Hi

 

There is a possible security risk with this contribution

 

The code can create a logfile which logs all errors – Even the ones from admin.

 

Anyone who knows this contribution is installed will know there maybe a logfile created which can contain the name of admin – even if Admin has been renamed.

 

RENAME THE LOGFILE TO SOMETHING THAT WILL BE DIFFICULT TO FIND

 

 

Regards

 

Ken

Edited by Ken44

Share this post


Link to post
Share on other sites

 

404 custom error page seems to load fine, but I'm getting this bug:

 

the Date From and Date to fields are auto filled with 'dd/mm/yyyy', however if user

 

a) omits to put proper 'from' and 'to' numerical dates, or

b ) delete the prefilled text dates,

 

it gives an Advanced Search error message with 'invalid from date' and 'invalid to date'.

 

If I instead go straight to the Advanced Search page and leave the 'From' and 'to' fields with prefilled 'dd/mm/yyy' text and do a search it does not yield any 'invalid date' messages.

 

Anybody have any help to provide for this problem?

Edited by Cheepnis

Share this post


Link to post
Share on other sites

Hi there

 

I have a heavily modded setup and have been usinf this contrb with no problems, however i have a multistore set up which is causeing a few problems if the item is on the other store, and what want to do is include the http_error,php file like

 

<?php

if ($product_check['total'] < 1) {

header("HTTP/1.1 404 Not Found");

header("Status: 404 Not Found");

require('http_error.php');

}else{

}

?>

 

which is working, well sort of its giving me redeclare errors ect, i am trying to use require_once instead of require but i am not sure if i am going about this the right way, any pointers would be great, maybe instead of require the file i should be doing something else?

 

thank you


David

Share this post


Link to post
Share on other sites

Great Contribution!

 

Three questions:

 

1.) What do the search engine spiders do when they come to one of the error pages -- do they not know it is a 404 page (for example) and call it a good search? Hopefully, that is the case.

 

2.) A lot of the emails I receive say there was a 403 (Forbidden) error generated by a call to sitename.com/images/ (Requested URL). If I click on the Referer link, the real product page comes up fine. There is no call to the images folder on the page without an image file name attached to it.

 

3.) What causes the 500 (Internal Server) error? If I click on the Requested URL, the real product page comes up properly.

Share this post


Link to post
Share on other sites

I still have this error message

 

Warning: error_log(/log/http_error.log) [function.error-log]: failed to open stream: No such file or directory in /home/content/41/9670941/html/http_error.php on line 48

 

I couldnt figure it out what is wrong

Share this post


Link to post
Share on other sites

I still have this error message

 

Warning: error_log(/log/http_error.log) [function.error-log]: failed to open stream: No such file or directory in /home/content/41/9670941/html/http_error.php on line 48

 

I couldnt figure it out what is wrong

 

I have deleted folder configuration in HTTP Errors Log Destination

 

 

It works now. Thanks for this contribution. I love it!!

Share this post


Link to post
Share on other sites

I've been at it for a couple of hours now and cannot get any custom HTTP error pages to appear. I'm still getting the same old generic error pages. I carefully followed instructions, but can't figure it out. Any suggestions what I can try?

Share this post


Link to post
Share on other sites

@wdepot

Hi, I downloaded and installed your update to this Add On.

Thanks for taking the time to update it. Some feedback on items not working however:

1. filenames.php I am fairly certain is deprecated in recent versions. I fixed by hardcoding the filenames.

2. the instructions ask the user to reference a /catalog/ directory in their .htaccess file.  I would assume most are installing oscommerce into their public_html folder and not using a catalog folder.

3. The pop up search help link does not work. It references a  popup_search_help.php file which is missing from my installation of osCommerce.

Peter


CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Share this post


Link to post
Share on other sites

1. filenames.php is active through all versions of osCommerce 2.3. Maybe in 2.4 they are removing it but the contribution wasn't updated for 2.4 but for 2.3

2. I thought I had updated the instructions to say that the htaccess (or httpd.conf) needed to point to the actual location of the http_error.php file.

3. The pop up search comes directly from the advanced_search.php file since the search portion of the error document was copied directly from the advanced_search.php file that came with osCommerce 2.3.4. Download a copy of osCommerce 2.3.4 and use the pop up search file from that if your version is missing the file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×