<?php if (!defined('iBUAA')) { exit('Access Denied'); } //配置 $seccodedata = array('width' => 100, 'height' => 40, 'adulterate' => '1', 'angle' => '0', 'shadow' => '1'); //验证码 $seccode = mkseccode(); //设定cookie ssetcookie('seccode', authcode($seccode, 'ENCODE')); if (function_exists('imagecreate') && function_exists('imagecolorset') && function_exists('imagecopyresized') && function_exists('imagecolorallocate') && function_exists('imagechar') && function_exists('imagecolorsforindex') && function_exists('imageline') && function_exists('imagecreatefromstring') && (function_exists('imagegif') || function_exists('imagepng') || function_exists('imagejpeg'))) { $bgcontent = seccode_background(); $im = imagecreatefromstring($bgcontent); if ($seccodedata['adulterate']) { seccode_adulterate(); } seccode_giffont(); if (function_exists('imagepng')) { header('Content-type: image/png'); imagepng($im); } else { header('Content-type: image/jpeg'); imagejpeg($im, '', 100); } imagedestroy($im); } else { $numbers = array('B' => array('00', 'fc', '66', '66', '66', '7c', '66', '66', 'fc', '00'), 'C' => array('00', '38', '64', 'c0', 'c0', 'c0', 'c4', '64', '3c', '00'), 'E' => array('00', 'fe', '62', '62', '68', '78', '6a', '62', 'fe', '00'), 'F' => array('00', 'f8', '60', '60', '68', '78', '6a', '62', 'fe', '00'), 'G' => array('00', '78', 'cc', 'cc', 'de', 'c0', 'c4', 'c4', '7c', '00'), 'H' => array('00', 'e7', '66', '66', '66', '7e', '66', '66', 'e7', '00'), 'J' => array('00', 'f8', 'cc', 'cc', 'cc', '0c', '0c', '0c', '7f', '00'), 'K' => array('00', 'f3', '66', '66', '7c', '78', '6c', '66', 'f7', '00'), 'M' => array('00', 'f7', '63', '6b', '6b', '77', '77', '77', 'e3', '00'), 'P' => array('00', 'f8', '60', '60', '7c', '66', '66', '66', 'fc', '00'), 'Q' => array('00', '78', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', '78', '00'), 'R' => array('00', 'f3', '66', '6c', '7c', '66', '66', '66', 'fc', '00'), 'T' => array('00', '78', '30', '30', '30', '30', 'b4', 'b4', 'fc', '00'), 'V' => array('00', '1c', '1c', '36', '36', '36', '63', '63', 'f7', '00'), 'W' => array('00', '36', '36', '36', '77', '7f', '6b', '63', 'f7', '00'), 'X' => array('00', 'f7', '66', '3c', '18', '18', '3c', '66', 'ef', '00'), 'Y' => array('00', '7e', '18', '18', '18', '3c', '24', '66', 'ef', '00'), '2' => array('fc', 'c0', '60', '30', '18', '0c', 'cc', 'cc', '78', '00'), '3' => array('78', '8c', '0c', '0c', '38', '0c', '0c', '8c', '78', '00'), '4' => array('00', '3e', '0c', 'fe', '4c', '6c', '2c', '3c', '1c', '1c'), '6' => array('78', 'cc', 'cc', 'cc', 'ec', 'd8', 'c0', '60', '3c', '00'), '7' => array('30', '30', '38', '18', '18', '18', '1c', '8c', 'fc', '00'), '8' => array('78', 'cc', 'cc', 'cc', '78', 'cc', 'cc', 'cc', '78', '00'), '9' => array('f0', '18', '0c', '6c', 'dc', 'cc', 'cc', 'cc', '78', '00')); foreach ($numbers as $i => $number) { for ($j = 0; $j < 6; $j++) { $a1 = substr('012', mt_rand(0, 2), 1) . substr('012345', mt_rand(0, 5), 1);
} else { seccode_adulteratefont(); $d[$i] = mt_rand(5, 15); } ob_start(); imagegif($im); imagedestroy($im); $frame[$i] = ob_get_contents(); ob_end_clean(); } $anim = new GifMerge($frame, 255, 255, 255, 0, $d, $x, $y, 'C_MEMORY'); dheader('Content-type: image/gif'); echo $anim->getAnimation(); } else { $im = imagecreatefromstring($bgcontent); $seccodedata['adulterate'] && seccode_adulterate(); $seccodedata['ttf'] && function_exists('imagettftext') || $seccodedata['type'] == 1 ? seccode_ttffont() : seccode_giffont(); if (function_exists('imagepng')) { dheader('Content-type: image/png'); imagepng($im); } else { dheader('Content-type: image/jpeg'); imagejpeg($im, '', 100); } imagedestroy($im); } } elseif ($seccodedata['type'] == 2 && extension_loaded('ming')) { $spacing = 5; $codewidth = ($seccodedata['width'] - $spacing * 5) / 4; $strforswdaction = ''; for ($i = 0; $i <= 3; $i++) {