magna
magna

Reputation: 287

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?

Upvotes: 0

Views: 517

Answers (1)

Michael
Michael

Reputation: 1886

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

Might help to see all the code.

Upvotes: 1

Related Questions