简体   繁体   English

为什么我的验证码失败?

[英]Why does my CAPTCHA code fail?

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? 谁能说出解决方案是什么?

How are you storing $_SESSION['randomnr2'] ? 您如何存储$ _SESSION ['randomnr2']? Are you md5()'ing it? 你在用md5()吗?

Might help to see all the code. 可能会帮助您查看所有代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM