a guest Sep 8th, 2011 54 Never
- jQuery Fancy Captcha
- Created by Web Design Beach.
- Copyright 2009 Web Design Beach. All rights reserved.
- session_start(); /* starts session to save generated random number */
- /* this compare captcha's number from POST and SESSION */
- if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST[captcha] && $_POST[captcha] == $_SESSION[captcha])
- echo "Passed!"; /* YOUR CODE GOES HERE */
- unset($_SESSION[captcha]); /* this line makes session free, we recommend you to keep it */
- elseif($_SERVER['REQUEST_METHOD'] == "POST" && !$_POST[captcha])
- echo "Failed!";
- /* in case that form isn't submitted this file will create a random number and save it in session */
- $rand = rand(0,4);
- $_SESSION[captcha] = $rand;
- echo $rand;
RAW Paste Data