验证码的验证,验证码防止灌水刷屏">

您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程

ecshop中验证码的使用方法

香巧2025-01-08 14:34:29ecshop商城教程已有人查阅

导读ECshop中验证码的调用验证码的验证,验证码防止灌水刷屏

ECshop中验证码的调用
<input type="text" size="8" name="captcha" class="inputBg" />
<img src="captcha.php?{$rand}" alt="captcha" onClick="this.src='captcha.php?'+Math.random()" class="captcha">
验证码的验证
if (empty($_POST['captcha']))
{
show_message($_LANG['order']['captcha_empty']);
}
include_once('includes/cls_captcha.php');
$validator = new captcha();
//$validator->session_word = 'captcha_login';
if (!$validator->check_word(($_POST['captcha'])))
{
show_message($_LANG['invalid_captcha']);
}
$GLOBALS['smarty']->assign('rand', mt_rand());
验证码防止灌水刷屏
if ((intval($_CFG['captcha']) & CAPTCHA_MESSAGE) && gd_version() > 0)
{
include_once('includes/cls_captcha.php');
$validator = new captcha();
// 验证验证码是否正确
if (!$validator->check_word($_POST['captcha']))
{
show_message($_LANG['invalid_captcha']);
}
}
else
{
//没有验证码时,用时间来限制机器人发帖或恶意发评论
if (!isset($_SESSION['send_time']))
{
$_SESSION['send_time'] = 0;
}
$cur_time = gmtime();
if (($cur_time - $_SESSION['send_time']) < 30) // 小于30秒禁止发评论
{
show_message($_LANG['cmt_spam_warning']);
}
}

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签