为什么我的验证码失败?
我为联系表单创建了验证码。一切正常,但无论我在验证码表单中输入多少数字,它总是显示无效的验证码,
<?php
if(isset($_POST['norobot']))
{
if(md5($_POST['norobot']) == $_SESSION['randomnr2'])
{
echo "Validation Success";
$_SESSION['name'] = $name ;
$_SESSION['phone_no'] = $phone;
$_SESSION['mailid'] = $mailid;
$_SESSION['msg'] = $msg;
$_SESSION['category'] = $category;
header("Location:thankyou.php");
}
else
{
$Error = 'Invalid CAPTCHA';
}
}
}
?>
有人能说出解决方案是什么吗?
I created a captcha for a contact form. Everything works fine but whatever the number I enter into the captcha form it always shows invalid captcha
<?php
if(isset($_POST['norobot']))
{
if(md5($_POST['norobot']) == $_SESSION['randomnr2'])
{
echo "Validation Success";
$_SESSION['name'] = $name ;
$_SESSION['phone_no'] = $phone;
$_SESSION['mailid'] = $mailid;
$_SESSION['msg'] = $msg;
$_SESSION['category'] = $category;
header("Location:thankyou.php");
}
else
{
$Error = 'Invalid CAPTCHA';
}
}
}
?>
can any one say what the solution is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您如何存储 $_SESSION['randomnr2'] ?你是 md5() 吗?
可能有助于查看所有代码。
How are you storing $_SESSION['randomnr2'] ? Are you md5()'ing it?
Might help to see all the code.