文字点选验证码
忘记传统的验证码输入方式吧!创新的文字点选验证码,让你通过选择正确的文字来验证你的人类身份。这种方式不仅更加便捷,还能有效防止机器人攻击。体验文字点选验证码的魅力!

php代码
<?php
include "kgcaptchasdk.php";
// 填写你的 appid,在应用管理中获取
$appid = "appid";
// 填写你的 appsecret,在应用管理中获取
$appsecret = "appsecret";
$request = new kgcaptcha($appid, $appsecret);
// 填写应用服务域名,在应用管理中获取
$request->appcdn = "https://cdn6.kgcaptcha.com";
// 前端验证成功后颁发的 token,有效期为两分钟
$request->token = $_post["kgcaptchatoken"];
// 当安全策略中的防控等级为3时必须填写
$request->userid = "kgcaptchademo";
// 请求超时时间,秒
$request->connecttimeout = 10;
$requestresult = $request->sendrequest();
if ($requestresult->code === 0) {
// 验签成功逻辑处理
echo "验证通过";
} else {
// 验签失败逻辑处理
echo "验证失败,错误代码:{$requestresult->code}, 错误信息:{$requestresult->msg}";
}html代码
<script src="https://cdn6.kgcaptcha.com/captcha.js"></script>
<script>
kg.captcha({
// 绑定元素,验证框显示区域
bind: "#captchabox",
// 验证成功事务处理
success: function(e) {
console.log(e);
},
// 验证失败事务处理
failure: function(e) {
console.log(e);
},
// 点击刷新按钮时触发
refresh: function(e) {
console.log(e);
}
});
</script>
<div id="captchabox">载入中 ...</div>最后
sdk开源地址:https://github.com/kgcaptcha,顺便做了一个演示:https://www.kgcaptcha.com/demo/
以上就是防止短信轰炸,行为验证码是关键的详细内容,更多关于防止短信轰炸,行为验证码是关键的资料请关注代码网其它相关文章!
发表评论