To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Article :: Building Dynamic Systems with Expressions in .NET
How Is XML Like An Interface?
Understanding Covariance and Contravariance
Print VS 2010 Keyboard Shortcut References in Letter (8.5x11in) and A4 (210×297mm) Sizes
Updated Productivity Power Tools



Go Back   VBForums > Other Languages > PHP

Reply Post New Thread
 
Thread Tools Display Modes
Old Aug 13th, 2004, 02:42 AM   #1
visualAd
Swine Buddy
 
visualAd's Avatar
 
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)
Lightbulb Error Handler Class

I just finished creating an error handling class in PHP. The source code is here:

http://www.sccode.com/projects/filem...src/error.phps

The documentation here:

http://www.sccode.com/projects/filem...r_handler.html

Feel free to use it if you like it and if you have any comments or suggestions, please let me know. Here's a quick code snippet demonstrating its use:
PHP Code:
<?php
include_once 'error.php';

$err = &new error;

$err->logpath = 'myerror.log';
$err->fatal_error_function = Array('friendly_exit');

$err->email_on_errors = true;
$err->email_send = 2;
$err->admin_email = 'me@mydomain.com';
$err->email_subject = 'My Custom Error Script';

/* this will produce a notice */
echo ($undefiend);

echo (
'this will be seen');

/* start an output buffer */
ob_start();

/* so will this */
$defined = hello;

echo (
'you will never see this');

/* this will produce a warning */
fputs($none, 'error');

/* this will produce a fatal error and end the script */
trigger_error('This is a fatal error. Bye bye.', E_USER_ERROR);

function
friendly_exit()
{
    
/* clear the current ouput buffer (if any)*/
    
if (ob_get_level() >= 1) ob_end_clean();
    
    echo (
'<h3>Error</h3>');
    echo (
'<p>I\\'m sorry, this application has had to terminate. Our maintainance team are aware of the problem and ');
    echo ('
are working to rectify it as soon as possible.</p>');
}
?>
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

| PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


Spread happiness and joy. Rate good posts.
visualAd is offline   Reply With Quote
Old Aug 13th, 2004, 07:29 AM   #2
ober0330
Frenzied Member
 
ober0330's Avatar
 
Join Date: Dec 01
Location: OH, USA
Posts: 1,945
ober0330 is an unknown quantity at this point (<10)
I've been meaning to write something like this. Thanks for doing the work for me.
__________________
format your code!! - [vbcode] [/vbcode]

ANSWERS CAN BE FOUND HERE!!

my personal company
ober0330 is offline   Reply With Quote
Old Aug 18th, 2004, 11:11 AM   #3
visualAd
Swine Buddy
 
visualAd's Avatar
 
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)
Just updated the class. It had a small bug in it.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

| PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


Spread happiness and joy. Rate good posts.
visualAd is offline   Reply With Quote
Old Jul 5th, 2008, 06:54 PM   #4
dclamp
Terrible Member
 
dclamp's Avatar
 
Join Date: Aug 06
Location: United States
Posts: 2,853
dclamp has a spectacular aura about (150+)dclamp has a spectacular aura about (150+)
Re: Error Handler Class

fail. 404 Error



edit:
along with this:
http://www.sccode.com/projects/filem...n_handler.html
dclamp is offline   Reply With Quote
Old Jul 6th, 2008, 02:39 AM   #5
visualAd
Swine Buddy
 
visualAd's Avatar
 
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)
Re: Error Handler Class

Fixed.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

| PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


Spread happiness and joy. Rate good posts.
visualAd is offline   Reply With Quote
Old Jul 6th, 2008, 01:14 PM   #6
dclamp
Terrible Member
 
dclamp's Avatar
 
Join Date: Aug 06
Location: United States
Posts: 2,853
dclamp has a spectacular aura about (150+)dclamp has a spectacular aura about (150+)
Re: Error Handler Class

ok great thanks! I might use it on a project that i am working on.
dclamp is offline   Reply With Quote
Old Jul 6th, 2008, 02:28 PM   #7
the182guy
Frenzied Member
 
the182guy's Avatar
 
Join Date: Nov 05
Location: Cheshire, UK
Posts: 1,471
the182guy has a spectacular aura about (100+)the182guy has a spectacular aura about (100+)
Re: Error Handler Class

Might be a nice idea to have a switch so that if on, when the email is sent, include the POST and GET vars, this would help identify the cause of the error, and also to catch people trying to hack it.
__________________
Chris

Codebank: Easy Javascript Form Validation (OOP)

If this post helped please rate it!
the182guy is offline   Reply With Quote
Old Jul 6th, 2008, 03:05 PM   #8
dclamp
Terrible Member
 
dclamp's Avatar
 
Join Date: Aug 06
Location: United States
Posts: 2,853
dclamp has a spectacular aura about (150+)dclamp has a spectacular aura about (150+)
Re: Error Handler Class

for admin_email can i include more then one email?
dclamp is offline   Reply With Quote
Old Jul 6th, 2008, 03:17 PM   #9
visualAd
Swine Buddy
 
visualAd's Avatar
 
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)
Re: Error Handler Class

It uses the PHP mail function, so there should not be an issue if you separate the addresses with a comma.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

| PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


Spread happiness and joy. Rate good posts.
visualAd is offline   Reply With Quote
Old Jul 6th, 2008, 03:31 PM   #10
dclamp
Terrible Member
 
dclamp's Avatar
 
Join Date: Aug 06
Location: United States
Posts: 2,853
dclamp has a spectacular aura about (150+)dclamp has a spectacular aura about (150+)
Re: Error Handler Class

ok i will try. The reason is i would like to have the script send an email to ME and then to the webmaster, who ever that is.
dclamp is offline   Reply With Quote
Old Jul 6th, 2008, 03:45 PM   #11
visualAd
Swine Buddy
 
visualAd's Avatar
 
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)visualAd is a splendid one to behold (700+)
Re: Error Handler Class

I am the webmaster. Done you remember?
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

| PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


Spread happiness and joy. Rate good posts.
visualAd is offline   Reply With Quote
Old Jul 6th, 2008, 04:02 PM   #12
dclamp
Terrible Member
 
dclamp's Avatar
 
Join Date: Aug 06
Location: United States
Posts: 2,853
dclamp has a spectacular aura about (150+)dclamp has a spectacular aura about (150+)
Re: Error Handler Class

silly me
dclamp is offline   Reply With Quote
Reply

Go Back   VBForums > Other Languages > PHP


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:03 PM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.