Çizimler yukarıdaki gibidir:
QapTcha, jQuery arayüzüne sahip jQuery sürüklenebilir bir captcha sistemidir!
QapTcha, kullanımı kolay, basit ve sezgisel bir captcha sistemidir. İnsan davranışı gerektiriyor, sabit diskin metnini okumak değil ve bu çok hafif bir jQuery eklentisi.
iPhone ve iPad ile çalışmak için jquery.ui.touch.js dosyası V2.5'te eklendi!
QapTcha, yukarıdaki nedenlerle PHP5.2'de çalışıyor çünkü json_encode()!
Nasıl çalışıyor? DOM yapımında, QapTcha rastgele bir isimle gizli bir giriş oluşturur: "attribut full of random passwords". Genellikle, bir bot formu göndermeden önce tüm girdileri bir forma doldurur.
Düşüşün amacı, rastgele girdiyi boşaltmak ve bu rastgele değeri Ajax'ta $_SESSION [qaptcha_key'] bir değişken ayarlamaktır.
PHP ile, rastgele girinin var olup olmadığını ve boş olup olmadığını kontrol edin; bu rastgele değeri $_SESSION['qaptcha_key'] doldurup doldurmadığını kontrol edin. PHP dosyalarında şöyle şeyler yapmanız gerekiyor:
- // 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']);
Kopya kodu Implementation:
1. Öncelikle, CSS & jQuery dosyalarını ekleyin- <!-- 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>
Kopya kodu 2. Formunuza "qaptcha" sınıfıyla bir DIV ekleyin
- <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>
Kopya kodu 3. PHP formu göndermeden önce kontrol
- // 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']);
Kopya kodu 4. Şimdi, Qaptcha eklentisini çağırın
- <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>
Kopya kodu
QapTcha-master.zip
(53.93 KB, İndirme sayısı: 13)
|