SERVER ERROR!
The server has encountered an error in running a PHP script.
The web developer is probably modifying the code for the requested page and made a mistake.
Try refreshing the page. If you continue to encounter this error, contact the IT department or the department in charge of the requested page.
Error Details:");
ini_set('error_append_string',"
");
set_error_handler(error_handler);
function error_handler($errno, $errstr, $errfile, $errline)
{
//this section may still need some work...
global $ERROR_LOGGING;
if (isset($ERROR_LOGGING))
{
if (!($ERROR_LOGGING&$errno))
return false;
}
//end section
if (!($errno&E_NOTICE))
{
$GLOBALS['ERROR_OCCURED']=true;
ob_start();
echo "$errstr in $errfile on $errline
";
echo "Current Memory Usage: ".er_parseBytes(memory_get_usage())."
";
echo "Peak Memory Usage: ".er_parseBytes(memory_get_peak_usage())."
";
echo "Occured after ".(microtime(true)-$GLOBALS['err_startTime'])." s
";
echo "Stack Trace:
";
//debug_print_backtrace();
$array=debug_backtrace();
for ($a=0; isset($array[$a]); $a++)
{
$l=$array[$a];
echo '#'.$a.' '.$l['function'].'(';
if ($a!=0)
{
if (is_array($l['args']))
{
foreach ($l['args'] as $key=>$arg)
{
if (is_array($arg))
$arg="Array(".implode(' , ',$arg).")";
echo ($key!=0?', ':'').htmlentities($arg);
}
}
else
{
echo $l['args'];
}
}
else
{
echo '_';
$l['file']=$errfile;
$l['line']=$errline;
}
echo ') called at ['.$l['file'].':'.$l['line']."]\n";
}
echo " ";
$data=ob_get_contents();
ob_end_clean();
log_alert("PHP Error #$errno",$data);
$GLOBALS['lastReportedError']=md5($errno.$errstr.$errfile.$errline);
}
if ($errno&E_WARNING)
{
echo "";
echo "Warning: $errstr in $errfile on $errline";
echo "
";
return true;
}
else if ($errno&E_USER_WARNING)
{
echo "";
echo "Warning: $errstr";
echo "
";
return true;
}
else if ($errno&E_USER_NOTICE)
{
return true;
}
return false;
}
function shutdown_error_check()
{
global $ERROR_LOGGING;
$error=error_get_last();
if ($error!==NULL)
{
$errno=$error['type'];
$errstr=$error['message'];
$errfile=$error['file'];
$errline=$error['line'];
if (isset($ERROR_LOGGING))
{
if (!($ERROR_LOGGING&$errno))
return;
}
//check to make sure error hasn't already been reported
if ($GLOBALS['lastReportedError']!=md5($errno.$errstr.$errfile.$errline))
{
if (!($errno&E_NOTICE))
{
$GLOBALS['ERROR_OCCURED']=true;
ob_start();
echo "$errstr in $errfile on $errline
";
echo "Current Memory Usage: ".er_parseBytes(memory_get_usage())."
";
echo "Peak Memory Usage: ".er_parseBytes(memory_get_peak_usage())."
";
echo "Occured after ".round((microtime(true)-$GLOBALS['err_startTime']),4)." s
";
echo "Stack Trace:
";
echo "\nStack Trace not available.";
echo "\nError found during shutdown.";
echo "
";
$data=ob_get_contents();
ob_end_clean();
log_alert("PHP Error #$errno",$data);
}
}
}
}
function log_alert($type,$data)
{
$type=la_escape($type);
$url=la_escape(($_SERVER['https']==on?"https://":"http://").$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$data=la_escape($data);
$ip=la_escape($_SERVER['REMOTE_ADDR']);
$timestamp=la_escape(time());
$query="insert into {$GLOBALS['alertDatabase']}.alerts values('','$type','$url','$data','$ip','$timestamp',false)";
mysql_query($query);
if (mysql_error()!="")
echo "Error alerting Developer";
}
function countAlerts($unreadOnly=false)
{
return getQueryResult("select count(*) from {$GLOBALS['alertDatabase']}.alerts".($unreadOnly?" where viewed=false":""));
}
function la_escape($string)
{
return mysql_real_escape_string($string);
}
//only define function if not already defined
if (!function_exists('er_parseBytes'))
{
//Purpose: convert bytes into size that is easier to read
//Input: $bytes (number of bytes)
//Output: number of gigabytes, megabytes, kilobytes as applicable
function er_parseBytes($bytes)
{
$tb=pow(2,40);
$gb=pow(2,30);
$mb=pow(2,20);
$kb=pow(2,10);
if ($bytes>$tb)
$string=($bytes/$tb)." TB";
else if ($bytes>$gb)
$string=($bytes/$gb)." GB";
else if ($bytes>$mb)
$string=($bytes/$mb)." MB";
else if ($bytes>$kb)
$string=($bytes/$kb)." KB";
else
$string=$bytes." B";
//round to two decimal places
$temp=explode(" ",$string);
$temp[0]=explode(".",$temp[0]);
$temp[0][1]=substr($temp[0][1],0,2);
if ($temp[1]=='B')
$string=$temp[0][0].' '.$temp[1];
else
$string=$temp[0][0].".".$temp[0][1]." ".$temp[1];
return $string;
}
}
?>