shane18 Posted December 19, 2009 Share Posted December 19, 2009 These errors would cause the page not to work at all and I don't care about logging the errors... so is this code I wrote the best way to handle the critical errors? // 0 error_reporting(0); // 1 if($_SERVER["SERVER_NAME"] == "www.finesttown.com"){ if(!SESSION_START()){ exit('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>FinestTown.com</title><meta http-equiv="content-type" content="text/html; charset=UTF-8"><link rel="shortcut icon" href="images/favicon.ico"></head><body style="background-color: #000000;"><div style="margin-top: -31.5px; margin-left: -212.5px; position: absolute; top: 50%; left: 50%; width: 425px; height: 63px;"><div style="text-align: center;"><img src="images/banner.bmp" alt="Banner"></div><div style="text-align: center; color: #FF6600; margin-top: 10px; border: 1px dashed #444444; font-size: 18px; font-face: Arial; padding: 3px;">~~<span style="color: #FFFFFF;">Critical Error</span>~~ <br> <span style="color: #FF0000;">SORRY FOR THE INCONVENIENCE</span></div></div></body></html>'); } $DB = new mysqli("HOST","USERNAME","PASSWORD","DATABASE"); if($DB->connect_errno){ exit('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>FinestTown.com</title><meta http-equiv="content-type" content="text/html; charset=UTF-8"><link rel="shortcut icon" href="images/favicon.ico"></head><body style="background-color: #000000;"><div style="margin-top: -31.5px; margin-left: -212.5px; position: absolute; top: 50%; left: 50%; width: 425px; height: 63px;"><div style="text-align: center;"><img src="images/banner.bmp" alt="Banner"></div><div style="text-align: center; color: #FF6600; margin-top: 10px; border: 1px dashed #444444; font-size: 18px; font-face: Arial; padding: 3px;">~~<span style="color: #FFFFFF;">Critical Error</span>~~ <br> <span style="color: #FF0000;">SORRY FOR THE INCONVENIENCE</span></div></div></body></html>'); } }else{ exit("<script type='text/javascript'>window.location='http://www.finesttown.com/';</script>"); } To see what the exit outputs, feel free to visit http://www.finesttown.com/ (I'm purposely creating a mysql connection error) Any suggestions? -- If my way is complete failure, criticize me 100% please... I want to become better Link to comment https://forums.phpfreaks.com/topic/185677-error-handling/ Share on other sites More sharing options...
shane18 Posted December 19, 2009 Author Share Posted December 19, 2009 If you don't have anything to criticize me on at least tell me you think it looks fine Link to comment https://forums.phpfreaks.com/topic/185677-error-handling/#findComment-980578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.