![]() |
|
#1
|
||||
|
||||
Error PagesNEW VERSION AVAILABLE: Error Handling with PHP
I am looking for a script that automatically sends an e-mail to an address I specify with details about: The URL the error occured at, the IP address of the user, and the time this occured. I want to add it to my 404.php page that is on my server(no other pages!) I can use a custom 404 page on my site, but I do not want to have to enter in any other information in my other pages. I have checked on hostscripts.com and could not find any. Anyone have a suggestion? The only ones I have found make you edit more pages than just the 404 page. Ideas? |
||||
|
#2
|
||||
|
||||
Handling Error 404 - Email notificationI haven't done this before so you might have to give me some feedback in case you decide to test it out.
First create a custom function in PHP, let's name it send_error_email(). PHP Code:
So, now, in your file named 404.php, you could simply add the following lines: PHP Code:
Like I mentioned earlier in my post, I haven't tested whether it gives you correct information nor that the code I wrote above actually works. I'll appreciate your feedback though. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
||||
|
||||
|
Parse error: parse error, unexpected '<' in /home/mrbobdou/public_html/errorpgs/404.php on line 18
HTML Code:
PHP Code:
Did I miss something? Both files are located at the errorpgs directory. |
|
#4
|
||||
|
||||
|
Try this instead:
PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
Done. Now even more.
[ERROR] Warning: main(functions.inc.php) [function.main]: failed to create stream: No such file or directory in /home/mrbobdou/public_html/errorpgs/404.php on line 11 Warning: main() [function.main]: Failed opening 'functions.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/mrbobdou/public_html/errorpgs/404.php on line 11 Fatal error: Call to undefined function: send_error_email() in /home/mrbobdou/public_html/errorpgs/404.php on line 17 [/ERROR] <-- Wonders if this will work or not. |
|
#6
|
||||
|
||||
|
Oh, I didn't notice that you had changed this line:
PHP Code:
In 404.php, that line should look like this: PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
||||
|
||||
About your 404 Error page...Just how is your 404 page being triggered?
From my own tests with some fake pages on your website, I can say with some degree of certainty that the code above is not going to work. On my own 404 page, you will see that the wrong URL is maintained in the address bar. Ignore the white font on 'white', I just haven't updated the CSS for that page since my last re-design. To trigger my 404 NOT Found errors, I added the following line to my .htaccess file in http://www.desilva.biz/.htaccess: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#8
|
||||
|
||||
|
I am not sure exactly how they work. What I have done is gone to my 'Settings' then 'Error pages' and used an 'External Page' http://www.mrbobdouglas.com/errorpgs/NameOfError.php
For the 404, it is http://www.mrbobdouglas.com/errorpgs/404.php This is what my .htaccess looks like: ErrorDocument 403 /ipw-web/errdocs/403.html ErrorDocument 401 /ipw-web/errdocs/401.html ErrorDocument 500 /ipw-web/errdocs/500.html ErrorDocument 400 /ipw-web/errdocs/400.html ErrorDocument 404 /ipw-web/errdocs/404.html ErrorDocument 404 http://www.mrbobdouglas.com/errorpgs/404.php Make note the only one repeating is the 404 error that i said i had made external- which could be why I get the problem Should I call tech support? What would I ask them? 1-888-511-4678 |
|
#9
|
||||
|
||||
|
Well... I just called them, they said they are going to put me through with a programmer some time in about 4 hours when he arrives.
|
|
#10
|
||||
|
||||
|
I just got an e-mail. But it said the page of the 404.php...
However, I tried it agaig, and now I did not get an e-mail. |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The