Advertisement
Guest User

niot workin

a guest
Aug 28th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. I tried
  2.  
  3.  
  4.  
  5. <?php
  6. session_start();
  7. echo "<html>
  8. <head>
  9. <title>Captcha</title>
  10. <center>
  11. <form method='POST' action='captcha.php'>
  12. <label>Entered Text:  </label><input type='text' name='captcha'>
  13. <input type='submit' name='submit' value='Submit Captcha!'>
  14. </form>
  15. </center>
  16. </head>
  17. </html>";
  18. $firstdigit = rand(1, 9);
  19. $seconddigit = rand(27, 105);
  20. $lastdigit = rand(1050, 9515);
  21. $middle = rand(1000, 20000);
  22. $captcha = "AX-$firstdigit-X-$seconddigit-K3I$middle-AN3Z-$lastdigit";
  23. $_SESSION['captcha'] = $captcha;
  24. echo "<b><center><font face=\"Arial\">$captcha</font></center></b>";
  25. ?>
  26.  
  27.  
  28.  
  29. and then
  30.  
  31.  
  32. <?php
  33. $captcha5 = $_SESSION['captcha'];
  34. $captcha2 = $_POST['captcha']; //This is the input field
  35. $submit = $_POST['submit'];  //This is Submit
  36. if ($submit) {
  37.   if ($captcha2) {
  38.     echo "Everything is good. $captcha5"; //Echo'd if everything is good
  39.    } else {
  40.   echo "Please fill in all fields."; //Echo'd if $captcha isn't filled out
  41.    }
  42.  } else {
  43. echo "Direct access not allowed.  Please click submit.";   //Echo'd if  submit is not pressed, and they access this directly.
  44. }
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement