验证码代码
function imagecircle($source,$r,$x,$y,$color){
for($i = 0;$i<=2*pi();$i+=(pi()/180)){
imageline($source,cos($i)*$r+$x,sin($i)*$r+$y,
cos($i+(pi()/180))*$r+$x,sin($i+(pi()/180))*$r+$y,$color);
}
} unset($_SESSION['seccode']);$im = imageCreate(90,28);
$bgcolor=imagecolorallocate($im,mt_rand(153,204),mt_rand(153,204),mt_rand(153,204));$textcolorb=imagecolorallocate($im, 218, 88, 213);for($i=0;$i<mt_rand($config['sitecodeaddtext1'],$config['sitecodeaddtext2']);$i++){
imagedashedline($im, mt_rand(0,100), mt_rand(0,100), mt_rand(0,100), mt_rand(0,100), $textcolorb);
}$font=S_DIR.'/'.$config['sitefont'];$text=random_text('4');$_SESSION['seccode']=md5($text);$textcolorf=imagecolorallocate($im,240,200,180);for($i=0;$i<4;$i++){
$textarr[]=substr($text,$i,1);
}
$txtw=0;
foreach($textarr as $key=>$text){
$txtw=$txtw+14+$key;
$txtnum=mt_rand(-10,10);
imageTTFText($im,18,$txtnum,$txtw,23,$textcolorb,$font,$text);
imageTTFText($im,18,$txtnum,$txtw,22,$textcolorb,$font,$text);
}for($i=0;$i<mt_rand($config['sitecodedeletetext1'],$config['sitecodedeletetext1']);$i++){
imagecircle($im,mt_rand(22,60),mt_rand(22,60),mt_rand(18,50),$bgcolor);
}
if($config['sitecodetype']==1){
header('Content-Type: image/png');
imagepng($im);
}else{
header('Content-Type: image/gif');
imagegif($im);
}imagedestroy($im); ?>2003服务器上出现的错误
这是访问那个验证码图片显示的
图像 “http://www.acoore.com/ajax.php?id=2&rand=0.31222021686809165” 因其本身有错无法显示。
function imagecircle($source,$r,$x,$y,$color){
for($i = 0;$i<=2*pi();$i+=(pi()/180)){
imageline($source,cos($i)*$r+$x,sin($i)*$r+$y,
cos($i+(pi()/180))*$r+$x,sin($i+(pi()/180))*$r+$y,$color);
}
} unset($_SESSION['seccode']);$im = imageCreate(90,28);
$bgcolor=imagecolorallocate($im,mt_rand(153,204),mt_rand(153,204),mt_rand(153,204));$textcolorb=imagecolorallocate($im, 218, 88, 213);for($i=0;$i<mt_rand($config['sitecodeaddtext1'],$config['sitecodeaddtext2']);$i++){
imagedashedline($im, mt_rand(0,100), mt_rand(0,100), mt_rand(0,100), mt_rand(0,100), $textcolorb);
}$font=S_DIR.'/'.$config['sitefont'];$text=random_text('4');$_SESSION['seccode']=md5($text);$textcolorf=imagecolorallocate($im,240,200,180);for($i=0;$i<4;$i++){
$textarr[]=substr($text,$i,1);
}
$txtw=0;
foreach($textarr as $key=>$text){
$txtw=$txtw+14+$key;
$txtnum=mt_rand(-10,10);
imageTTFText($im,18,$txtnum,$txtw,23,$textcolorb,$font,$text);
imageTTFText($im,18,$txtnum,$txtw,22,$textcolorb,$font,$text);
}for($i=0;$i<mt_rand($config['sitecodedeletetext1'],$config['sitecodedeletetext1']);$i++){
imagecircle($im,mt_rand(22,60),mt_rand(22,60),mt_rand(18,50),$bgcolor);
}
if($config['sitecodetype']==1){
header('Content-Type: image/png');
imagepng($im);
}else{
header('Content-Type: image/gif');
imagegif($im);
}imagedestroy($im); ?>2003服务器上出现的错误
这是访问那个验证码图片显示的
图像 “http://www.acoore.com/ajax.php?id=2&rand=0.31222021686809165” 因其本身有错无法显示。
一对乱码�PNG IHDRZ�wXAlPLTE����X��ȴ������Ì��w��m�Ȃ��b�ƅ��k����g��|��s��Y��a�Ň��Z����`��_��r��j��g��j��]����c��^��x��^��s̾��E���IDATH�Օ�r� �9C���'�D�����.�q�$��E�>Ξ*�� #ss{��S�[k�Q���GW(THHF�+��ċ��O/�QKãc�V���]�گ�VP3�6�e����Wany�Tc!�#�qJ��J��2���6 <�ȹ_{8lH�Ί�;��|;J�����W�v�v�qX�h�4g�>�1h���ͮq���LF��cP��L9�j���UR�H��0Z�Nt�de}�ɍ;�;�nP�����XEv���67�'���]�{��}��Ѥ�h� s��m��yW���e�jR�E����_�zө��dp��GA˰苦EN�c�Mwh�{�HǢwX��N���j�etxK�pL���4�����K���%.bIBW�1aS���x� � 'l��X�srO�{��*I˭H�H1 t����P��Lq=�0������g��)����xv�!�#�S{�a�N�Щ�-�)��*��IEND�B`�
function random_text($count, $lowercase = '0')
{
srand((double) microtime() * 1000000);
$doublenum = mt_rand(10000, 1000000);
srand((double) microtime() * $doublenum);
if ($lowercase)
{
$numrand = array_flip(
array_merge(range(1, 9), range('A', 'N'), range('P', 'Z'),
range('a', 'n'), range('p', 'z')));
}
else
{
$numrand = array_flip(
array_merge(range(1, 9), range('A', 'N'), range('P', 'Z')));
}
$textkey = '';
for ($i = 0; $i < $count; $i ++)
{
$textkey .= array_rand($numrand);
}
return $textkey;
}
这是访问那个验证码图片显示的
图像 “http://www.acoore.com/ajax.php?id=2&rand=0.31222021686809165” 因其本身有错无法显示。这个 就是错误提示哇
php.ini 中
display_errors=On
error_reporting=E_ALL & ~E_NOTICE
重启apache后,注释掉header在运行,提示什么错误?
你的意思是在这个
display_errors=On
地下下 就加一行
error_reporting=E_ALL & ~E_NOTICE这个??
提示错误 就是乱码�PNG IHDRZ�wXAuPLTE����X��ȴ�y��cӲ���nѪ�ʺ����`��t��ZԶ���]��Y��{ϰ�˩�ɼ�μ���h��q��\��t��aӷ�̾��f��l��e��pз���j��_��k��u��^��mѶ4a^�IDATH���R�0���-�)�B[z:,���H����$0\1G7���D���E&��u����U��j��7��,� ��%�ҪU [i�LY������-�k���E�yרy�[�!� �6!8㽾t�W�f���_��\b Q�P��ܣ_����=pLo2��ݲ�,�M�+ά:�9� � �]T��wQ5��=����Gw��臬r�JA܊<� ���ڻ�n�T=�W��n�9���r7�ѩ_���}�8p>t�RTM�����Q�~��$�q� s�x��o��Χ ��&d�n}� vrm8����4�����s��N��8A��f�;��fE�'�O���4���{7-�Z9����{)�E�G�"z�x�D3E��½�Mq ZKz]�s�~�VH���D����x)�4��9�\!�� ��ҷ�2jv W���d�r{�� ���K���9���IEND�B`�