亚洲综合婷婷,欧美电影一区二区三区,日本一区二区三区在线看,精品成人免费一区二区在线播放,日本高清二区,丁字裤翘臀美女,99热热99

首頁(yè) 服務(wù) 產(chǎn)品 文檔 關(guān)于

TQCMS 驗(yàn)證碼無(wú)法正常顯示問(wèn)題

因?yàn)?span style="font-family:"font-size:medium;">do_seccode.php編輯不當(dāng),帶bom頭導(dǎo)致,找攻擊清除即可。

以下代碼保存為php到站點(diǎn)根目錄運(yùn)行科將所有包含bom頭的文件清除bom頭


if (isset($_GET['dir'])) { //設(shè)置文件目錄
? ? $basedir = $_GET['dir'];
} else {
? ? $basedir = '.';
}

$auto = 1;
checkdir($basedir);

function checkdir($basedir)
{
? ? if ($dh = opendir($basedir)) {
? ? ? ? while (($file = readdir($dh)) !== false) {
? ? ? ? ? ? if ($file != '.' && $file != '..') {
? ? ? ? ? ? ? ? if (!is_dir($basedir . "/" . $file)) {
? ? ? ? ? ? ? ? ? ? echo "filename: $basedir/$file " . checkBOM("$basedir/$file") . "
";
? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? $dirname = $basedir . "/" . $file;
? ? ? ? ? ? ? ? ? ? checkdir($dirname);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? closedir($dh);
? ? }
}
function checkBOM($filename)
{
? ? global $auto;
? ? $contents? ?= file_get_contents($filename);
? ? $charset[1] = substr($contents, 0, 1);
? ? $charset[2] = substr($contents, 1, 1);
? ? $charset[3] = substr($contents, 2, 1);
? ? if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
? ? ? ? if ($auto == 1) {
? ? ? ? ? ? $rest = substr($contents, 3);
? ? ? ? ? ? rewrite($filename, $rest);
? ? ? ? ? ? return ('BOM found, automatically removed.');
? ? ? ? } else {
? ? ? ? ? ? return ('BOM found.');
? ? ? ? }
? ? } else
? ? ? ? return ("BOM Not Found.");
}

function rewrite($filename, $data)
{
? ? $filenum = fopen($filename, "w");
? ? flock($filenum, LOCK_EX);
? ? fwrite($filenum, $data);
? ? fclose($filenum);
}
?>