From 02a7b492a8f3102e8cbba4607bde906b565b1aee Mon Sep 17 00:00:00 2001 From: cookie Date: Thu, 30 Nov 2006 10:49:10 +0000 Subject: [PATCH] error_handler gibt jetzt uebersichtlich SQL fehler aus git-svn-id: svn://svn.cccv.de/engel-system@186 29ba0400-6e00-0410-a75a-ca02368028f8 --- www-ssl/inc/error_handler.php | 55 ++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/www-ssl/inc/error_handler.php b/www-ssl/inc/error_handler.php index fa6f9f22..cbb3bd83 100755 --- a/www-ssl/inc/error_handler.php +++ b/www-ssl/inc/error_handler.php @@ -8,8 +8,24 @@ // general error handler collecting all messages in an array function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context) { - global $error_messages; - array_push($error_messages, "Error Number: ".$error_number."\nError String: ".$error_string."\nError File: ".$error_file."\nError Line: ".$error_line."\n"); + global $error_messages, $con; + + //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 @@ -32,23 +48,42 @@ $message = ""; foreach($error_messages as $value) $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)) + { foreach ($_SESSION as $k => $v ) $message .= "_SESSION: $k = $v\n"; + $message .= "\n"; + } + if( isset( $_SESSION['CVS'])) + { foreach ($_SESSION['CVS'] as $k => $v ) if( strlen($k)>3 ) $message .= "_SESSION['CVS']: $k = $v\n"; + $message .= "\n"; + } + foreach ($_SERVER as $k => $v ) - $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"; + if( strpos( "0$k", "SERVER_")==0) + $message .= "_SERVER: $k = $v\n"; send_message($message);