验证码的实现1

<?php
    
//图像验证码生成
    function actionImgcode()
    {
        
$imgcode = & FLEA::getSingleton('FLEA_Helper_ImgCode');
        
/**
        * @param int $type 验证码包含的字符类型,0 - 数字、1 - 字母、其他值 - 数字和字母
        * @param int $length 验证码长度may
        * @param int $leftime 验证码有效时间(秒)
        * @param array $options 附加选项,可以指定字体、宽度和高度等参数,默认是GD库设置的字体
        
*/
        
$imgcode->image(2, 5);
    }
    
//图像验证码验证
    function actionImgCheck()
    {
        
$imgcode = & FLEA::getSingleton('FLEA_Helper_ImgCode');
        
if (!$imgcode->check($_POST['imgcode'])) {
            
echo "<font color=\"Red\">不正确或超时</font>";
        } 
else {
            
echo 'right';
        }
        
include('helper_imgcode.php');
    }

posted on 2008-04-25 22:06  52Qin  阅读(220)  评论(0编辑  收藏  举报