📄 ck.func.php
字号:
<?php#[验证码]function SetCheckCodes(){ $x_size=90; $y_size=30; if(function_exists("imagecreate")) { $aimg = imagecreate($x_size,$y_size); $back = imagecolorallocate($aimg, 255, 255, 255); $border = imagecolorallocate($aimg, 0, 0, 0); imagefilledrectangle($aimg, 0, 0, $x_size - 1, $y_size - 1, $back); $font = 'tahoma.ttf'; $txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $txtlen=strlen($txt); $thetxt=""; for($i=0;$i<4;$i++) { $randnum=mt_rand(0,$txtlen-1); $randang=mt_rand(-20,20); //文字旋转角度 $rndtxt=substr($txt,$randnum,1); $thetxt.=$rndtxt; $rndx=mt_rand(2,7); $rndy=mt_rand(0,9); $colornum1=($rndx*$rndx*$randnum)%255; $colornum2=($rndy*$rndy*$randnum)%255; $colornum3=($rndx*$rndy*$randnum)%255; $newcolor=imagecolorallocate($aimg, $colornum1, $colornum2, $colornum3); if(function_exists("imagettftext")) { imagettftext($aimg, 14, $randang, $rndx+$i*21, 16+$rndy, $border, $font, $rndtxt); imagettftext($aimg, 14, $randang, $rndx+$i*21+1, 16+$rndy+1, $newcolor, $font, $rndtxt); } else { imageString($aimg,5,$rndx+$i*21,5+$rndy,$rndtxt,$newcolor); } } unset($txt); $thetxt = strtolower($thetxt); setcookie("qgLoginChk",md5($thetxt),time()+1800,"/"); imagerectangle($aimg, 0, 0, $x_size - 1, $y_size - 1, $border); $newcolor=""; $newx=""; $newy=""; $pxsum=150; //干扰像素个数 for($i=0;$i<$pxsum;$i++) { $newcolor=imagecolorallocate($aimg, mt_rand(0,254), mt_rand(0,254), mt_rand(0,254)); imagesetpixel($aimg,mt_rand(0,$x_size-1),mt_rand(0,$y_size-1),$newcolor); } header("Pragma:no-cache"); header("Cache-control:no-cache"); header("Content-type: image/png"); imagepng($aimg); imagedestroy($aimg); exit; }}SetCheckCodes();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -