为什么我的CAPTCHA代码失败了?

时间:2021-01-24 15:39:14

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?

任何人都可以说解决方案是什么?

1 个解决方案

#1


1  

How are you storing $_SESSION['randomnr2'] ? Are you md5()'ing it?

你是如何存储$ _SESSION ['randomnr2']的?你是md5()吗?

Might help to see all the code.

可能有助于查看所有代码。

#1


1  

How are you storing $_SESSION['randomnr2'] ? Are you md5()'ing it?

你是如何存储$ _SESSION ['randomnr2']的?你是md5()吗?

Might help to see all the code.

可能有助于查看所有代码。