Jump to content

404 error reporting


damiancds

Recommended Posts

At first I was doing this in php but then decided to it might be better to have it in javascript and the php code in noscript tags, in case it was off.what it'd like is when the 404 page is accessed, it sends an email automatically (to me for error fixing purposes) and I'd like to be able to:detect current urldetect previous page (so i can easily find the problematic link and possibly inform externally linked sites of a moved page) (reason for switch to javascript from php)can anyone give me some advice on how to do this,thanks

Link to comment
Share on other sites

in case PHP was turned off?I saw your thread in PHP sub-forum and DD's idea is pretty spot on. I think what you might want to do is when the 404 page has been directed to, use javascript to get (using browser history):1) currentURL (wouldn't this be the 404 error page?)2) previous page (current page in history -1 )and then set these as the values of hidden form inputs on the page during window.onLoad, and then use PHP to send this form to your email address using mail(), all automated without the user knowing, or having to do anything.This could all be done with a regular HTML page, just using the features of both languages.

Link to comment
Share on other sites

Keep in mind though, PHP can't be turned off by the user... it's either available on the server, or it's not. If it is, there's no need to worry if it becomes off.

Link to comment
Share on other sites

The reason for going from php to javascript wasn't if they turned it off (which, they can't you pointed out) it was because i didn't think that with php I could get the previous page. There's no reason now to even use javascript for this because of the $_SERVER array (which I didn't know about before).I just tested it out and it works, unsurprisingly,all that i have left is to work it into the message that gets sentThanks a million,I mean this will make it so much easier to find the problem and fix, though hopefully people will hardly ever see this page.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...