Le rappresentazioni sono le sopra:
QapTcha è un sistema captcha trascinabile con jQuery UI!
QapTcha è un sistema captcha facile da usare, semplice e intuitivo. Richiede il comportamento umano, non la lettura del testo dell'hard disk, ed è un plugin jQuery molto leggero.
Per funzionare con iPhone e iPad, è stato aggiunto il file jquery.ui.touch.js nella versione 2.5!
QapTcha funziona in PHP5.2 per i motivi sopra riportati sulla funzione json_encode()!
Come funziona? Nella costruzione del DOM, QapTcha crea un input nascosto con un nome casuale "attributo pieno di password casuali." Tipicamente, un bot inserisce tutti gli input in un modulo prima di inviarlo.
Lo scopo del drop è svuotare l'input casuale e impostare una variabile $_SESSION [qaptcha_key'] con questo valore casuale in Ajax.
Con PHP, basta controllare se l'input casuale esiste ed è vuoto, se $_SESSION['qaptcha_key'] popola questo valore casuale. Nei file PHP devi fare cose come:
- // 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']);
Copia codice Implementation:
1. Innanzitutto, includere i file CSS & jQuery- <!-- 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>
Copia codice 2. aggiungi un DIV con la classe "qaptcha" nel tuo modulo
- <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>
Copia codice 3. PHP controllo prima di inviare il modulo
- // 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']);
Copia codice 4. Ora, chiama il plugin Qaptcha
- <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>
Copia codice
QapTcha-master.zip
(53.93 KB, Numero di download: 13)
|