The renderings are as above:
QapTcha is a jQuery draggable captcha system with jQuery UI!
QapTcha is an easy-to-use, simple and intuitive captcha system. It requires human behavior, not reading the text of the hard drive, and this is a very lightweight jQuery plugin.
To work with iPhone and iPad, file jquery.ui.touch.js has been added in V2.5!
QapTcha works PHP5.2 for the above reasons for the function json_encode()!
How does it work? In DOM construction, QapTcha creates a hidden input with a random name "attribut full of random passwords." Typically, a bot fills in all inputs into a form before sending the form.
The purpose of the drop is to empty the random input and set a $_SESSION [qaptcha_key'] variable with this random value in Ajax.
With PHP, just check if the random input exists and is empty, if $_SESSION['qaptcha_key'] populates this random value. In PHP files, you have to do things like:
- // check if $_SESSION['qaptcha_key'] created with AJAX exists
- if(isset($_SESSION['qaptcha_key']) && !empty($_SESSION['qaptcha_key']))
- {
- $myVar = $_SESSION['qaptcha_key'];
-
- // check if the random input created exists and is empty
- if(isset($_POST[''.$myVar.'']) && empty($_POST[''.$myVar.'']))
- {
- //mail can be sent
- }
- else
- {
- //mail can not be sent
- }
- }
- unset($_SESSION['qaptcha_key']);
Copy code Implementation:
1. First, include the CSS & jQuery files- <!-- include CSS & JS files -->
- <!-- CSS file -->
- <link rel="stylesheet" type="text/css" href="QapTcha.jquery.css" media="screen" />
-
- <!-- jQuery files -->
- <scrip去掉t type="text/javascrip去掉t" src="jquery.js"></scrip去掉t>
- <scrip去掉t type="text/javascrip去掉t" src="jquery-ui.js"></scrip去掉t>
- <scrip去掉t type="text/javascrip去掉t" src="jquery.ui.touch.js"></scrip去掉t>
- <scrip去掉t type="text/javascrip去掉t" src="QapTcha.jquery.js"></scrip去掉t>
Copy code 2. add a DIV with the class "qaptcha" into your form
- <form method="post" action="">
- <fieldset>
- <label>First Name</label> <input type="text" name="firstname" />
- <label>Last Name</label> <input type="text" name="lastname" />
- <div class="clr"></div>
-
- <!-- Add this line in your form -->
- <div class="QapTcha"></div>
-
- <input type="submit" name="submit" value="Submit form" />
- </fieldset>
- </form>
Copy code 3. PHP control before sending the form
- // check if $_SESSION['qaptcha_key'] created with AJAX exists
- if(isset($_SESSION['qaptcha_key']) && !empty($_SESSION['qaptcha_key']))
- {
- $myVar = $_SESSION['qaptcha_key'];
-
- // check if the random input created exists and is empty
- if(isset($_POST[''.$myVar.'']) && empty($_POST[''.$myVar.'']))
- {
- //mail can be sent
- }
- else
- {
- //mail can not be sent
- }
- }
- unset($_SESSION['qaptcha_key']);
Copy code 4. Now, call Qaptcha plugin
- <scrip去掉t type="text/javascrip去掉t">
- $(document).ready(function(){
- // Simple call
- $('.QapTcha').QapTcha();
-
- // More complex call
- $('.QapTcha').QapTcha({
- autoSubmit : true,
- autoRevert : true,
- PHPfile : 'path_to_my_php_file/Qaptcha.jquery.php'
- });
- });
- </scrip去掉t>
Copy code
QapTcha-master.zip
(53.93 KB, Number of downloads: 13)
|