Advertisement
Guest User

lolcaptcha

a guest
Sep 8th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?
  2. /*
  3.   captcha.php
  4.   jQuery Fancy Captcha
  5.   www.webdesignbeach.com
  6.  
  7.   Created by Web Design Beach.
  8.   Copyright 2009 Web Design Beach. All rights reserved.
  9. */
  10. session_start(); /* starts session to save generated random number */
  11.  
  12. /* this compare captcha's number from POST and SESSION */
  13. if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST[captcha] && $_POST[captcha] == $_SESSION[captcha])
  14.     {
  15.         echo "Passed!"; /* YOUR CODE GOES HERE */
  16.         unset($_SESSION[captcha]); /* this line makes session free, we recommend you to keep it */
  17.     }
  18. elseif($_SERVER['REQUEST_METHOD'] == "POST" && !$_POST[captcha])
  19.     {
  20.         echo "Failed!";
  21.     }
  22. /* in case that form isn't submitted this file will create a random number and save it in session */
  23. else
  24.     {
  25.         $rand = rand(0,4);
  26.         $_SESSION[captcha] = $rand;
  27.         echo $rand;
  28.     }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement