选择语言 :

 Core_Captcha::valid

null Core_Captcha::valid( )
File: ./core/classes/captcha.class.php
public static function valid($mycode, $delsession = false)
{
    if ( !($code = Session::instance()->get(Captcha::$sessionname)) )
    {
        return 0;
    }
    else
    {
        if ( TIME - $code['time'] <= Captcha::$config['life'] && $code['time'] > 0 && strtoupper($mycode) == strtoupper($code['code']) )
        {
            if ( $delsession ) Session::instance()->delete(Captcha::$sessionname, Captcha::$valid_countname);
            return 1;
        }
        else
        {
            $errornum = (int)Session::instance()->get(Captcha::$valid_countname) + 1;
            Session::instance()->set(Captcha::$valid_countname, $errornum);
            return - $errornum;
        }
    }
}