Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

lolcaptcha

By: a guest on Sep 8th, 2011  |  syntax: PHP  |  size: 0.82 KB  |  views: 53  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>