Changeset 1473575
- Timestamp:
- 08/13/2016 05:59:28 AM (9 years ago)
- Location:
- wp-light-captcha
- Files:
-
- 7 added
- 3 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/css (added)
-
tags/1.0.1/css/style.css (added)
-
tags/1.0.1/lib (added)
-
tags/1.0.1/lib/mc.class.php (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/wp-light-captcha.php (added)
-
trunk/css/style.css (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-light-captcha.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-light-captcha/trunk/css/style.css
r1356285 r1473575 1 #wplc_user_answer { 2 width: 100%; 3 height: 28px !important; 4 position: relative; 5 top: 7px; 6 font-size: 15px; 7 border-radius: 4px; 8 font-weight: 800; 9 color: #666; 10 } 11 #wplc_comment_user_answer{ 12 width: 110px; 13 } -
wp-light-captcha/trunk/readme.txt
r1356285 r1473575 33 33 = 1.0.1 = 34 34 * Style captcha answer input box 35 36 = 2.0 = 37 * Captcha security is available in comment section. 38 * Style changes -
wp-light-captcha/trunk/wp-light-captcha.php
r1356285 r1473575 4 4 * Plugin URI: http://learn24bd.com/portfolio/wp-light-captcha 5 5 * Description: WP Light Captcha is very simple and lightweight captcha plugins for your WordPress site.You can protect unwanted login request from hackers. 6 * Version: 1.0.16 * Version: 2.0 7 7 * Author: Harun 8 8 * Author URI: http://learn24bd.com … … 10 10 */ 11 11 require __DIR__ . "/lib/mc.class.php"; 12 13 function wplc_load_style() 14 { 15 wp_register_style('wplc_style', plugins_url('css/style.css', __FILE__)); 16 wp_enqueue_style('wplc_style'); 17 } 18 add_action('wp_enqueue_scripts', 'wplc_load_style'); 19 20 12 21 add_action('login_form', 'wplc_login_form'); 13 14 22 function wplc_login_form() 15 23 { 16 24 Mc::putMcData(); 17 25 ?> 18 <style>19 #wplc_user_answer{20 width: 100%;21 height: 28px!important;22 position: relative;23 top: 7px;24 font-size: 15px;25 border-radius: 4px;26 font-weight: 800;27 color: #666;28 }29 </style>30 26 <table> 31 27 <tr> 32 <td width="45%"><strong>Captcha:</strong> <?= Mc::getMcQuestion();?></td>28 <td width="45%"><strong>Captcha:</strong> <?= Mc::getMcQuestion(); ?></td> 33 29 <td> 34 <input type="hidden" name="wplc_a" value="<?=md5(Mc::getMcAnswer())?>"> 35 <input type="text" id="wplc_user_answer" name="wplc_user_answer" placeholder="Put Answer" required="required"> 30 <input type="hidden" name="wplc_a" value="<?= md5(Mc::getMcAnswer()) ?>"> 31 <input type="text" id="wplc_user_answer" name="wplc_user_answer" placeholder="Put Answer" 32 required="required"> 36 33 </td> 37 34 </tr> … … 45 42 { 46 43 if (isset($_POST['wplc_user_answer']) && isset($_POST['wplc_a'])) { 47 $userAnswer = md5($_POST['wplc_user_answer']);44 $userAnswer = md5($_POST['wplc_user_answer']); 48 45 $actualAnswer = $_POST['wplc_a']; 49 46 if ($userAnswer == $actualAnswer) { … … 59 56 60 57 } 58 59 add_action('comment_form', 'wplc_comment_captcha_display'); 60 function wplc_comment_captcha_display() 61 { 62 Mc::putMcData(); 63 ?> 64 65 <p><strong>Captcha:</strong> <?= Mc::getMcQuestion(); ?></p> 66 <input type="hidden" name="wplc_a" value="<?= md5(Mc::getMcAnswer()) ?>"> 67 <input type="text" id="wplc_comment_user_answer" name="wplc_comment_user_answer" 68 placeholder="Put Answer" required="required"> 69 70 <?php 71 } 72 73 add_filter('preprocess_comment', 'wplc_comment_validate_captcha_field'); 74 function wplc_comment_validate_captcha_field($commentdata) 75 { 76 if (isset($_POST['wplc_comment_user_answer']) && isset($_POST['wplc_a'])) { 77 $userAnswer = md5($_POST['wplc_user_answer']); 78 $actualAnswer = $_POST['wplc_a']; 79 if ($userAnswer == $actualAnswer) { 80 return $commentdata; 81 } else { 82 wp_die(__('<strong>Sorry!</strong> incorrect captcha')); 83 } 84 } else { 85 wp_die(__('<strong>Sorry!</strong> you must enter captcha')); 86 } 87 }
Note: See TracChangeset
for help on using the changeset viewer.