Project captcha (CleanView - Demo - Download)
=Form page=
1. add image and input fileds to your form (as in demo)
2. make sure you used session_start(); at the beginning of the page.
=Target page=
3. include and instantiate a new Captcha() object
4. use the method isValid() to check if the entered code is valid
« Back
Description
The name of this project tells everything by itself ! It's a little captcha generator which creates human-readable check codes which will keep you away from spammers and flooders. It requires PHP 4/5 with GD library.| Styles Demo:: captcha.php?style=[0-3] | s1 s2 |
s3 s4 |
Docs
Script usage:=Form page=
1. add image and input fileds to your form (as in demo)
2. make sure you used session_start(); at the beginning of the page.
=Target page=
3. include and instantiate a new Captcha() object
4. use the method isValid() to check if the entered code is valid
D
O
C
S
O
C
S
<?session_start(); //<-must start SESSION if not done beforeinclude 'class.captcha.php';if($_POST['sent']=='true'){$captcha= new Captcha();if($captcha->isValid()){echo '<font color=green>Correct code !</font>';} else {echo '<font color=red>Invalid code :(</font>';}}// == FORM$thisFile=$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];if(!strstr($_SERVER['QUERY_STRING'], 'PHPSESSID')) $thisFile.='&PHPSESSID='.session_id();echo '<form action="'.$thisFile.'#demo" method="post"><a href="captcha_test.php" title="Reload"><img src="captcha.php?style=0&PHPSESSID='.session_id().'" alt="capcha image" border="0" /></a><br>Code:<input type="text" name="cap_code" size="5"><input type="hidden" name="sent" value="true"><input type="submit" name="sub" value="Check"></form>';?>
« Back
s2
s4