帝国CMS验证码不显示的解决方法

来源:互联网 发布:中国黑客攻击日本网络 编辑:程序博客网 时间:2024/05/16 18:29

1、GD库没有打开

  • 一般的虚拟主机都会将GD库打开的,如果GD库没有打开,那么访问http://…/e/showkey/index.php就会出现一堆乱码,可以告知空间提供商让他们帮助开启,如果是自己的主机,那么打开php.ini找到extension=php_gd2.dll将前面的“;”号去掉,重启APACHE或IIS就可以,以前的PHP版本是extension=php_gd.dll。或者你可以将以下代码另存为php文件传到你空间里,如果有GD标题就说明开启了GD库

2、批量去掉BOM头代码

<?php
if (isset($_GET['dir'])){ //设置文件目录
$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")." <br>";
}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 ("<font color=red>BOM found, automatically removed._<a href=http://www.yeetech.com>http://www.yeetech.com</a></font>");
} else {
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite ($filename, $data) {
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
?>

0 0