I have a page that looks similar to this:
Code: Select all
<?php
//cs.php
ob_start();
session_name('TS_Test');
session_start();
// Check for PHP Errors
include('error.php');
//RUN MySQL QUERIES
include ('Query1.php');
include ('Query2.php');
include ('Query3.php');
include ('Query4.php');
//Display the results
include ('Query1res.php');
include ('Query2res.php');
include ('Query3res.php');
include ('Query4res.php');
?>
Code: Select all
<?php
//error.php
register_shutdown_function('fatalErrorShutdownHandler');
function fatalErrorShutdownHandler()
{
$error = error_get_last();
if ($error['type'] === E_ERROR) {
// fatal error
while (ob_get_level()) ob_end_clean();
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
header('refresh: 30; url=cs.php');
}
print "ERROR TYPE = ".$error['type'];
}
}
// now, run everything else prepared to handle errors gracefully
function customError($errno, $errstr)
{
header( 'Location: error3.php' ) ;
die();
}
set_error_handler("customError");
?>