error_handler gibt jetzt uebersichtlich SQL fehler aus

git-svn-id: svn://svn.cccv.de/engel-system@186 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
cookie 2006-11-30 10:49:10 +00:00
parent 5557ac1b4a
commit 02a7b492a8
1 changed files with 45 additions and 10 deletions

View File

@ -8,8 +8,24 @@
// general error handler collecting all messages in an array // general error handler collecting all messages in an array
function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context) function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context)
{ {
global $error_messages; global $error_messages, $con;
array_push($error_messages, "Error Number: ".$error_number."\nError String: ".$error_string."\nError File: ".$error_file."\nError Line: ".$error_line."\n");
//SQL error genauer analysiert
$Temp = "";
foreach ($error_context as $k => $v )
if( (strpos( "0$k", "sql") > 0) || (strpos( "0$k", "SQL") > 0))
$Temp .= "Error Context: $k = $v\n";
if( (strpos( "0$error_string", "MySQL") > 0) )
$Temp .= "Error MySQL: ". mysql_error($con). "\n";
//übergeben des arrays
array_push( $error_messages, "Error Number: $error_number\n".
"Error String: $error_string\n".
"Error File: $error_file\n".
"Error Line: $error_line\n".
(strlen($Temp)? "$Temp": "")
);
} }
// register error handler // register error handler
@ -32,23 +48,42 @@
$message = ""; $message = "";
foreach($error_messages as $value) foreach($error_messages as $value)
$message .= $value."\n"; $message .= $value."\n";
$message .= "\n\n\n\n\n"; $message .= "\n";
if( isset( $_POST))
{
foreach ($_POST as $k => $v )
$message .= "_POST: $k = ". ( $k!="password"? $v : "???..."). "\n";
$message .= "\n";
}
if( isset( $_GET))
{
foreach ($_GET as $k => $v )
$message .= "_GET: $k = $v\n";
$message .= "\n";
}
$message .= "\n\n";
if( isset( $_SESSION)) if( isset( $_SESSION))
{
foreach ($_SESSION as $k => $v ) foreach ($_SESSION as $k => $v )
$message .= "_SESSION: $k = $v\n"; $message .= "_SESSION: $k = $v\n";
$message .= "\n";
}
if( isset( $_SESSION['CVS'])) if( isset( $_SESSION['CVS']))
{
foreach ($_SESSION['CVS'] as $k => $v ) foreach ($_SESSION['CVS'] as $k => $v )
if( strlen($k)>3 ) if( strlen($k)>3 )
$message .= "_SESSION['CVS']: $k = $v\n"; $message .= "_SESSION['CVS']: $k = $v\n";
$message .= "\n";
}
foreach ($_SERVER as $k => $v ) foreach ($_SERVER as $k => $v )
if( strpos( "0$k", "SERVER_")==0)
$message .= "_SERVER: $k = $v\n"; $message .= "_SERVER: $k = $v\n";
if( isset( $_POST))
foreach ($_POST as $k => $v )
$message .= "_POST: $k = ". ( $k!="password"? $v : "???..."). "\n";
if( isset( $_GET))
foreach ($_GET as $k => $v )
$message .= "_GET: $k = $v\n";
send_message($message); send_message($message);