代码如下所示:
复制代码 代码如下:
'error', 2=>'warning', 4=>'parse', 8=>'notice', 16=>'core_error', 32=>'core_warning', 64=>'compile_error', 128=>'compile_warning', 256=>'user_error', 512=>'user_warning', 1024=>'user_notice', 2047=>'all', 2048=>'strict');
$msg = sprintf(%s: %s at file %s(%s), $error_no_arr[$error] ,$error_string, $filename, $line);
if(in_array($error,array(1,2,4))){
echo $msg; echo \n;//調試顯示
//發送信息
if($error==1||$error==2) {
sendbankmsg($error_string); //發送簡訊
if(strpos($error_string, 'xml_parse(): bytes:')!==false){
writefiltefile($error_string);
}
}
}
}
function hex2bin($hexdata) {
$bindata = '';
for($i=0; $i $bindata .= chr(hexdec(substr($hexdata, $i, 2)));
}
return $bindata;
}
function writefiltefile($error_string)
{
if(strpos($error_string, 'xml_parse(): bytes:')===false||strpos($error_string, ' 0x')===false){
return;
}
//寫入文件
$filename = 'filtetext.php';
include($filename);
$error_string = str_replace('xml_parse(): bytes:', '', $error_string);
$error_string = str_replace(' 0x','', $error_string);
$error_text = hex2bin($error_string);
$filtetextarr[] = $error_text;
$temparr = array_unique($filtetextarr);//去除重復
$result = implode(',',$temparr);
$result = ;
filewrite($filename, $result, 'w');
}
function sendbankmsg($msg)
{
$timestamp = time();
$params = msg=.$msg
.&posttime=.$timestamp;
$length = strlen($params);
//创建socket连接
$domain = www.admin.com; //socket域名
$actionpath = /action/bank/bankmsg.php; //文件路徑
$fp = fsockopen($domain,80);
//构造post请求的头
if($fp){
$header = post .$actionpath. http/1.1\r\n;
$header .= host:.$domain.\r\n;
$header .= content-type: application/x-www-form-urlencoded\r\n;
$header .= content-length: .$length.\r\n;
$header .= connection: close\r\n\r\n;
//添加post的字符串
$header .= $params.\r\n;
//发送post的数据
fputs($fp,$header);
while (!feof($fp)) {
$line = fgets($fp,1024); //去除请求包的头只显示页面的返回数据
if ($inheader && ($line == \n || $line == \r\n)) {
echo $line;
}
}
fclose($fp);
}
}
function filewrite($ffilename, $fcontent, $ftag = 'w') {
ignore_user_abort (true);
$fp = fopen($ffilename, $ftag);
if (flock($fp, lock_ex)) {
fwrite($fp, $fcontent);
flock($fp, lock_un);
}
fclose($fp);
ignore_user_abort (false);
return;
}
?>
http://www.bkjia.com/phpjc/327209.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/327209.htmltecharticle代码如下所示: 复制代码 代码如下: ?php /** * 更新非法字符、發送錯誤信息 * * @author * @copyright 2009-06-10 */ error_reporting(e_error | e_warning | e_pa...