Home
Home

Directory
Directory

Articles
Internet News
Security News
Ecommerce News
Domain News

Site Tools
Site Speed Test
Keyword Research
Resolve Hostname
DNS Tools
Register Domains
Affiliate Programs
Open Source

Shopping Carts
Cart Reviews
SSL Certificates

Enter your email address to subscribe to our updates:

Delivered by FeedBurner


Venue Charts
Channel Traffic Rankings
OAI Stock Quotes and Charts
eBay's Worst Feedback

Forum
Forum Home
TulipTools News
Advertising
Blogging
Computer Hardware
Domain Names
Ecommerce
Financing
Int'l Trading
Graphics and HTML
Internet Access
Legal Issues
Internet Business
Auction Sites
Classified Ad Sites
Fixed Price Venues
Operating Systems
Programming
Search Engines
Internet Security
Software
Web Hosting
Webmaster Issues
Reviews
Announcements
Off Topic Discussion

Web Hosting
TulipHosting

Domain Names
TulipDomains

Web Stats
TulipStats

Forum Rules
Forum Rules
Privacy Policy

Site Map
Forum Sitemap
Sitemap Topics




Directory| Forums| Internet News|Cart Reviews| DNS Tools| Keyword Research| Site Speed Test| Security| | Domain Marketplace| Domain Blog
TulipTools Internet Business Owners and Online Sellers Community
  • Home
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register
TulipTools Internet Business Owners and Online Sellers Community › Programming and Databases › Programming and Databases › PHP v
1 2 Next »

Error handling

  
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Error handling
12-05-2007, 10:31 PM,
Post: #1
tony.willson Offline
Tool Seeker
*
Posts: 3
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Dec 2007
Reputation: 0
Error handling
We struggle to come up with a decent error handling function. I thought that I use a global variable $live to easily make a switch from testing to live. I will keep the function in an include file.
I kind of got there to print a "user-friendly" message when the site is live, but it messes up the whole page layout. Don't how to print the error message in the content area. How would I adjust my error handler and what would I add to ""?

My error handler:
/*-- start output buffering--*/
ob_start();
/*-- live site --*/
$live=TRUE;
/*-- error handling function giving back error number, the actual message, the error file, the error line and the variables (what are variable in this context?) --*/
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {
/*-- make $live global --*/
global $live;
/*-- set error message for testing together --*/
$message="Error in file '$e_file' on line $e_line: $e_message\n";
$message.=print_r($e_vars,1);
/*-- error message for live site should not give any detail about problem, just an apology --*/
if($live){
$user="We apologise for the problems on this page...";
/*-- if there are error messages print the standard user message --*/
if ($message==0){echo $user;}else{
/*-- otherwise say 'hi there' --*/
echo ('');}
/*-- do it only once as user should not see the apology more than once --*/
exit();
} else {
/*-- if site is in testing print the acual error messages --*/
echo '
'.$message.'

';
}
}
ob_end_flush();
/*-- as everything is defined now, set the error handler, so it's ready to be used --*/
set_error_handler('my_error_handler');
?>

Also, in the bit "if ($message==0)" I would have thought that comparing $message to 1 would have printed the user-friendly error message (as I thought 1 means that there is one or more error message).


Any help appreciated.
Buy Cheap Ink Cartridge at LowerPriceUSA.com instant approval credit card bad credit
Like Post Reply
[+]
« Next Oldest | Next Newest »


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)
  • Contact Us
  • TulipTools Internet Business Owners and Online Sellers Community
  • Return to Top
  • Lite (Archive) Mode
  • RSS Syndication
  • Help
Current time: 05-28-2023, 01:01 PM Powered By MyBB, © 2002-2023 MyBB Group. Theme created by Justin S.
powered by Apache

powered by Linuxpowered by CentOS

Copyright 2000-2013 TulipTools.com. All rights reserved.