【发布时间】:2015-03-19 13:49:25
【问题描述】:
我目前正在我的网站上为验证码实施 securimage。 the quickstart guide 中给出的示例运行良好。但不是直接处理页面并回显一个随机语句,我希望它的行为方式与the demo page 中的相同,当在同一页面上输入错误的验证码时会显示一个消息框。我查看了启用此功能的 javascript 或 Jquery 的源代码,但找不到任何东西。任何可以实现此功能的指针。
我想要实现的流程是;
->输入的表单->转到“process.php”->如果“验证码的值错误”-“在主表单中回显”。如何在表单本身上显示 echo 语句?这就是我想知道的。不将用户引导至“process.php”文件并显示错误回显。
这是确定输入到验证码中的值是正确还是错误的部分过程代码。
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// you should handle the error so that the form processor doesn't continue
// or you can use the following code if there is no validation or you do not know how
$captchaerror = "The security code entered was incorrect.<br /><br />";
exit;
}
【问题讨论】:
-
无js,php简单回显文本
-
您不需要Java Script,您可以在用户提交错误的验证码时回显消息。