Home  >  Article  >  Backend Development  >  win+iis+php架构网站不显示验证码解决思路

win+iis+php架构网站不显示验证码解决思路

WBOY
WBOYOriginal
2016-06-13 11:48:021265browse

win+iis+php架构网站不显示验证码
http://www.xmfoodcn.com/system/login.php   

验证码不显示

require_once '../global.php';

function king_ajax_salt(){
global $king;
$id_fly=kc_post('ID');
$id=substr($id_fly,0,strlen($id_fly)-4);
$salt=kc_random(12);
$js="\$('#{$id}_salt').val('{$salt}');";
$s="win+iis+php架构网站不显示验证码解决思路lang->get('system/check/verifynew')."\" src=\"".$king->config('inst')."system/verify.php?salt={$salt}\"/>";
$s.="".$king->lang->get('system/check/verifynew')."";
kc_ajax('',$s,0,$js);
}

function king_def(){

global $king;
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // 过去的时间

header("Content-type: image/png");

$salt=kc_get('salt',1,1);

$width=$king->config('verifywidth');//图片长度
$height=$king->config('verifyheight');//图片高度
$size=$king->config('verifysize');//文字大小
$num=$king->config('verifynum');//文字数量
$content=$king->config('verifycontent');//随机字符

$array_content=explode('|',$content);
$array_content=array_diff($array_content,array(null));
$array_font=kc_f_getdir('system/verify_font','ttf|ttc');

$str='';

$img=imageCreate($width,$height);//创建一个空白图像
imageFilledRectangle($img, 0, 0, $width, $height, imagecolorallocate($img,255,255,255));

//写字
for($i=0;$i $code=$array_content[array_rand($array_content)];
$str.=$code;//验证码字符
$color=imageColorAllocate($img,rand(0,128),rand(0,128),rand(0,128));
$font='verify_font/'.$array_font[array_rand($array_font)];//随机读取一个字体
$left=rand(round($size*0.2),round($size*0.4))+$i*$size;
imagettftext($img,rand(round($size*0.7),$size), rand(-20,20), $left,rand(round($size*1.2),$size*1.4),$color,$font,$code);
}
//画星号
$max=$width*$height/400;
for($i=0;$i imagestring($img, 15, rand(0,$width), rand(0,$height), '*',rand(192,250));
}
//画点
$max=$width*$height/40;
for($i=0;$i imageSetPixel($img, rand(0, $width), rand(0, $height), rand(1,200));
}
//画线
$max=$width*$height/800;
for($i=0;$i imageline($img,rand(0,$width),rand(0,$height),rand(0,$width),rand(0,$height),rand(0,255));
}
//写验证码到verify中
$verify=new KC_Verify_class;
$verify->Put($salt,$str);

imagePng($img);
imageDestroy($img);

$verify->Clear();
}
?>
------解决方案--------------------

$s = file_get_contents('http://www.xmfoodcn.com/system/verify.php?salt=pkommyjkafe7');<br />echo substr($s, 3);<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn