简体   繁体   中英

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'] ? Are you md5()'ing it?

Might help to see all the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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