Kod
//----------------------------
// Define our own error handler
//----------------------------
function solarbox_error($errno, $errstr, $errfile, $errline, $errcontext)
{
ob_start();
print_r($errcontext);
$errcontext = ob_get_contents();
//$errcontext = preg_replace('/\[sql_pass\] => ([a-zA-z0-9_-]{6,32})/si', "[sql_pass] => *******", $errcontext);
$errcontext = preg_replace('/\[sql_pass\] \=\> (.*?)/si', '[sql_pass] => *******', $errcontext);
ob_end_clean();
echo "<h1>There was an error...</h1>\n";
echo "<table cellspacing='1' cellpadding='1' border='0' width='800'>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error number:</b></td><td style='background-color:#CCC;'>" . $errno . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error message:</b></td><td style='background-color:#CCC;'>" . $errstr . "</td>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>File:</b></td><td style='background-color:#CCC;'>" . basename($errfile) . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Line:</b></td><td style='background-color:#CCC;'>" . $errline . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error contexts:</b></td><td style='background-color:#CCC;'><pre>" . $errcontext . "</pre></td></tr>\n";
echo "</table>\n";
echo "<p>Admin was informed about this error...</p>\n";
exit;
}
set_error_handler('solarbox_error', E_ALL);
// Define our own error handler
//----------------------------
function solarbox_error($errno, $errstr, $errfile, $errline, $errcontext)
{
ob_start();
print_r($errcontext);
$errcontext = ob_get_contents();
//$errcontext = preg_replace('/\[sql_pass\] => ([a-zA-z0-9_-]{6,32})/si', "[sql_pass] => *******", $errcontext);
$errcontext = preg_replace('/\[sql_pass\] \=\> (.*?)/si', '[sql_pass] => *******', $errcontext);
ob_end_clean();
echo "<h1>There was an error...</h1>\n";
echo "<table cellspacing='1' cellpadding='1' border='0' width='800'>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error number:</b></td><td style='background-color:#CCC;'>" . $errno . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error message:</b></td><td style='background-color:#CCC;'>" . $errstr . "</td>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>File:</b></td><td style='background-color:#CCC;'>" . basename($errfile) . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Line:</b></td><td style='background-color:#CCC;'>" . $errline . "</td></tr>\n";
echo "<tr><td style='width:200px; background-color:#CCC;'><b>Error contexts:</b></td><td style='background-color:#CCC;'><pre>" . $errcontext . "</pre></td></tr>\n";
echo "</table>\n";
echo "<p>Admin was informed about this error...</p>\n";
exit;
}
set_error_handler('solarbox_error', E_ALL);
wszystko jest ładne ale przy Error context: jest mały problem bo:
Kod
Array
(
[GLOBALS] => Array
*RECURSION*
[_POST] => Array
(
)
[_GET] => Array
(
)
[_COOKIE] => Array
(
)
[_FILES] => Array
(
)
[config] => Array
(
[sql_type] => mysql
[sql_host] => localhost
[sql_user] => db_user
[sql_pass] => *******Pa$$w0rd
[sql_name] => db_name
[sql_table_prefix] => tbl_
)
)
(
[GLOBALS] => Array
*RECURSION*
[_POST] => Array
(
)
[_GET] => Array
(
)
[_COOKIE] => Array
(
)
[_FILES] => Array
(
)
[config] => Array
(
[sql_type] => mysql
[sql_host] => localhost
[sql_user] => db_user
[sql_pass] => *******Pa$$w0rd
[sql_name] => db_name
[sql_table_prefix] => tbl_
)
)
no i tutaj jest mój problem bo tego Pa$$w0rd nie powinno być, powinny być same gwiazdki (przynajmniej takie było założenie)... No chyba, że w regexpach sie gdzieś walnąłem...