【问题标题】:CAPTCHA checking fail no matter i input correctly无论我输入正确,验证码检查都会失败
【发布时间】:2012-04-15 13:01:58
【问题描述】:

我正在使用secureImage,这是一种实现验证码的简单方法, 我按照那里的指南添加代码,但是,即使我输入了正确的值,检查也总是无效

就是那个插件的website,十行代码之内:

这是我的代码:

html 格式

<img id="captcha" src="http://www.phpcaptcha.org/securimage3/securimage_show.php?0.6905195268336684" alt="CAPTCHA Image">

<input type="text" class="required" name="captcha_code" size="10" maxlength="6">

在验证php中

include_once '../plugin/securimage/securimage.php';

$securimage = new Securimage();


if ($securimage->check($_POST['captcha_code']) == false) {
  die ("<div class='alert alert-success'><strong>The security code entered was incorrect.</strong><br /><br />Please go <a href='javascript:history.go(-1)'>back</a> and try again.</div>");
}

我已经检查了帖子值,这正是我输入的内容。我想知道插件用来与我的输入比较的数据,但是,我不能通过回显 $secureimage 来做到这一点

谢谢

【问题讨论】:

  • 不要使用验证码。它们的存在只是为了惹恼用户并适合懒惰的管理员。

标签: php captcha


【解决方案1】:

要将随机生成的图像与用户输入的代码进行比较,需要一个有效的会话。请检查此quick start guide 并阅读有关将 session_start() 置于 PHP 脚本之上的部分。

【讨论】:

    【解决方案2】:

    如果你懒得写代码,也许你可以试试http://www.google.com/recaptcha。它被广泛使用,我认为它比secureimage更好。您可以在this site 获得一个 php 实现。如果我不直接回答您的问题,我很抱歉,这是因为 Mr.GolezTrol 建议不要使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-20
      • 1970-01-01
      • 2021-08-18
      • 1970-01-01
      • 2016-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多