前台验证码应用部分:<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的方法接受数据的。)
<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的方法接受数据的。)
<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&icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&audio_file=%2Fsecurimage%2Fsecurimage_play.php" height="32" width="32"><param name="movie" value="/securimage/securimage_play.swf?bgcol=%23ffffff&icon_file=%2Fsecurimage%2Fimages%2Faudio_icon.png&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" />
但发送的只是 data:"m=pay&c=deposit&a=public_checknewcode"