前台验证码应用部分:<tr>
       <th>验证码:</th>
       <td>{Securimage::getCaptchaHtml()}<td>
<tr>前台验证部分:$("#captcha_code").formValidator({
            onshow:"请输入验证码",onfocus:"验证码不能为空"}).inputValidator({
            min:1,max:999,onerror:"验证码不能为空"}).ajaxValidator({
        type:"get",
        url:"",
        data:"m=pay&c=deposit&a=public_checknewcode",
datatype : "html",
async:'false',
success : function(data){
            if(data == 1){return true;}
            else{return false;}
},
buttons: $("#dosubmit"),
onerror : "验证码错误",
onwait : "验证中"
});checknewcode()方法如下:public function public_checknewcode(){
        include_once 'securimage/securimage.php';
        $image = new Securimage();
        if ($image->check($_GET['captcha_code']) == true) {
            exit('1');
        } else {
            exit('0');
        }
    }(PS:securimage 是开源的php验证码。后台验证是可以通过的,但是后台是用post的方法接受数据的。)

解决方案 »

  1.   

    没有看到你前台传递了 captcha_code
      

  2.   

    PS:cecurimage中cecuriamge类中有方法(getCode())可以获取code,但是我在public_checknewcode()方法中if判断前添加这样一段代码:$code=$image->getCode(true);exit($code['code']); 然后再在前台alert(data);打印出的结果是空的。
      

  3.   

    captcha_code在Securimage类中getCaptchaHtml()方法中。
      

  4.   

    Securimage::getCaptchaHtml()在我本地解析的结果如下:
    <img align="left" id="captcha_image" src="/securimage/securimage_show.php?a83c130acb4f46323bd8d3bfd8ea7440" alt="CAPTCHA Image" /><object type="application/x-shockwave-flash" data="/securimage/securimage_play.swf?bgcol=%23ffffff&amp;icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&amp;audio_file=%2Fsecurimage%2Fsecurimage_play.php" height="32" width="32"><param name="movie" value="/securimage/securimage_play.swf?bgcol=%23ffffff&amp;icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&amp;audio_file=%2Fsecurimage%2Fsecurimage_play.php" /></object><br /><a tabindex="-1" style="border: 0" href="#" title="Refresh Image" onclick="document.getElementById('captcha_image').src = '/securimage/securimage_show.php?' + Math.random(); this.blur(); return false"><img height="32" width="32" src="/securimage/images/refresh.png" alt="Refresh Image" onclick="this.blur()" align="bottom" border="0" /></a><br /><div style="clear: both"></div><label for="captcha_code">请输入验证码:</label> <input type="text" name="captcha_code" id="captcha_code" /> 
      

  5.   

    你是有 <input type="text" name="captcha_code" id="captcha_code" />
    但发送的只是 data:"m=pay&c=deposit&a=public_checknewcode"
      

  6.   

    我是用get的方法发送数据的,ajaxValidator会自动将表单中的值发送过去(测试过,$_GET['captcha_code']获取的值和表单输入的值一致),而这个data数据,主要是为了我的项目可以找到public_checknewcode()方法。
      

  7.   

    if ($image->check($_GET['captcha_code']) == true)  判断不通过。但是如果不做前台验证,直接提交(post方式提交的)到后台,后台的if ($image->check($_POST['captcha_code']) == true)判断却通过了,不解。
      

  8.   

    求解啊  急~ 有用过securiamge的吗?
      

  9.   

    我也遇到这问题,调试了下,发现是构造那里没跑到session_start(),我在调用这个验证码类前手动加了个session_start()就好了