-
Notifications
You must be signed in to change notification settings - Fork 1
/
captcha.php
executable file
·44 lines (30 loc) · 944 Bytes
/
captcha.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
captcha.php
jQuery Fancy Captcha
www.webdesignbeach.com
Created by Web Design Beach.
Copyright 2009 Web Design Beach. All rights reserved.
*/
$check = false;
session_start(); /* starts session to save generated random number */
/* this compare captcha's number from POST and SESSION */
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_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 */
$check = true;
}
elseif($_SERVER['REQUEST_METHOD'] == "POST" && !isset($_POST['captcha']))
{
$check = false;
}
/* in case that form isn't submitted this file will create a random number and save it in session */
else
{
$rand = rand(0,4);
$check = false;
$_SESSION['captcha'] = $rand;
echo $rand;
}
?>