Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //using a boolean variable to check if the site's online or not
- $isAlive=FALSE;
- ////////////////////////////////////////////////////////////////////////
- //This function will handle all the errors//////////////////////////////
- //that may occur in the site's functioning./////////////////////////////
- //$errorNumber - shows the error's number///////////////////////////////
- //$errorMessage - shows what message the error holds////////////////////
- //$errorFile - shows what file's generating the error///////////////////
- //$errorLine - shows what line in $errorFile's generating the error/////
- //$errorVar - shows what variable in $errorLine's generating the error//
- ////////////////////////////////////////////////////////////////////////
- function errorHandler($errorNumber, $errorMessage, $errorFile, $errorLine, $errorVar)
- {
- global $isAlive;
- //building the error message
- $message="An error occured in script '$errorFile' on line $errorLine: $errorMessage\n";
- $message.=print_r($errorVar, 1);
- if($isAlive) {//we won't be showing the error
- echo '<div class="error">A system error occured. We apologize for the trouble we caused you.';
- } else {//we're showing the error
- echo '<div class="error">' . $message . '</div><br />';
- }
- }
- set_error_handler('errorHandler');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement