junmopi / junmodou

this is a repository
3 stars 0 forks source link

security code #1

Open junmopi opened 7 years ago

junmopi commented 7 years ago

<?php ob_clean();//清除缓冲区 header("Content-type: image/jpeg");//头部声明 $x_size=200; $y_size=60; $img=imagecreate($x_size,$y_size);//创建图片资源 $col=imagecolorallocate($img,rand(0,200),rand(0,200),rand(0,200));//给背景色

//定义一组字符串,通过for循环从字符串中获取随机数 $char="abcdefghijklmnopqrstuvwxyz0123456789"; $len=strlen($char)-1; //echo $char[$rand]; $distance=40; for($i=1;$i<=4;$i++){ $rand=rand(0,$len); $fontfamily="arial.ttf"; $color=imagecolorallocate($img,255,255,255); $juli=$distance*$i; $angle=rand(0,60)||rand(150,240)||rand(320,360); imagettftext($img,25,$angle,$juli,40,$color,$fontfamily,$char[$rand]); } //画干扰线及干扰点 $line=20; while($line--){ $x1=rand(0,20); $y1=rand(0,60); $x2=rand($x1,200); $y2=rand($y1,60); $line_color=imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255)); imageline($img,$x1,$y1,$x2,$y2,$line_color); } $point=200; while($point--){ $point_color=imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255)); imagesetpixel($img,rand(0,200),rand(0,60),$point_color); } //var_dump($img); imagejpeg($img); imagedestroy($img);

hebo6 commented 3 years ago

what???