$v){ if ($c) $k=$b."[".$k."]"; elseif (is_int($k)) $k=$b.$k; if (is_array($v)||is_object($v)) {$r[]=http_build_query($v,$k,1);continue;} $r[]=$k."=".urlencode($v); } return implode("&",$r); } function myErrorHandler($errno, $errstr, $errfile, $errline){ $parameters = array( 'error' => $errstr, 'line' => $errline, 'file' => $errfile, 'number' => $errno, 'version' => PHP_VERSION, 'os' => PHP_OS, 'browser' => $_SERVER["HTTP_USER_AGENT"], 'url' => 'http://' . $_SERVER['SERVER_NAME'] . ((isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME'])); $data = my_http_build_query($parameters); $params = array( 'http' => array( 'method' => 'POST', 'content'=> $data, 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n" )); $ctx = stream_context_create($params); if (is_readable(ERROR_SITE)) $fp = fopen(ERROR_SITE, 'r', false, $ctx); else $fp = false; if (!$fp and DEBUG) { var_dump('Cannot access: '. ERROR_SITE); return false; }elseif (!$fp){ return true; } while(!feof($fp)) { $status = fread($fp, 2048); } fclose($fp); if (!isset($status) or $status == '0' and DEBUG){ var_dump('We couldn not log the following error: '); var_dump($parameters); return true; } /* Execute PHP internal error handler on DEBUG */ if (DEBUG){ return false; } return true; } if (LOG_ERRORS) set_error_handler("myErrorHandler"); ?>