WP Armour – Honeypot Anti Spam - Version 1.0

Version Description

  • First Release
Download this release

Release Info

Developer dnesscarkey
Plugin Icon 128x128 WP Armour – Honeypot Anti Spam
Version 1.0
Comparing to
See all releases

Version 1.0

honeypot.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: HoneyPot
4
+ Plugin URI: http://wordpress.org/plugins/honeypot/
5
+ Description: Add Honey Pot spam protection.
6
+ Author: Dinesh Karki
7
+ Version: 1.0
8
+ Author URI: https://dineshkarki.com.np
9
+ */
10
+
11
+ include 'includes/hp_config.php';
12
+ include 'includes/hp_functions.php';
13
+ include 'includes/integration/hp_bbpress.php';
14
+ include 'includes/integration/hp_wpcomment.php';
15
+ include 'includes/integration/hp_wpregistration.php';
16
+ include 'includes/integration/hp_contactform7.php';
17
+ include 'includes/integration/hp_wpforms.php';
18
+ include 'includes/integration/hp_gravityforms.php';
19
+
20
+ add_action('wp_enqueue_scripts','hp_load_scripts');
21
+ add_action('login_enqueue_scripts','hp_load_scripts');
22
+ add_action('admin_menu', 'hp_plugin_menu');
23
+
24
+ register_activation_hook( __FILE__, 'hp_plugin_activation' );
25
+
26
+ function hp_plugin_activation(){
27
+ add_option('honeypot_field_name','field'.rand(1,9999));
28
+ add_option('honeypot_error_message',' Spamming or your Javascript is disabled !!');
29
+ }
includes/hp_config.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ $GLOBALS['honeypot_field_name'] = get_option('honeypot_field_name');
4
+ $GLOBALS['honeypot_hidden_field'] = "<span style='display:none;height:0;width:0;'><input type='text' name='".$GLOBALS['honeypot_field_name']."' value='1' style='' /></span>";
5
+ $GLOBALS['honeypot_error_message'] = get_option('honeypot_error_message');
includes/hp_functions.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function hp_load_scripts(){
3
+ echo '<script>var honeypot_hidden_field = "'.$GLOBALS['honeypot_hidden_field'].'";</script>';
4
+ wp_enqueue_script( 'hpscript', plugins_url( '/js/hp.js', __FILE__ ), array ( 'jquery' ), 1.0, true);
5
+ }
6
+
7
+ function hp_plugin_menu(){
8
+ add_menu_page( 'HoneyPot', 'HoneyPot', 'manage_options', 'honeypot', 'hp_options','dashicons-shield');
9
+ }
10
+
11
+ function hp_options(){
12
+ $hp_tabs = array(
13
+ 'settings' => array('name'=>'Settings','path'=>'hp_settings.php'),
14
+ 'extended_version' => array('name'=>"What's in HoneyPot Extended ?",'path'=>'hp_extended_version.php')
15
+
16
+ );
17
+
18
+ $hp_tabs = apply_filters( 'hp_tabs_filter', $hp_tabs);
19
+
20
+ include 'views/hp_main.php';
21
+ }
22
+
23
+ function hp_save_settings(){
24
+ $all_fields = $_POST;
25
+ unset($all_fields['submit-hp-general-settings']); // REMOVE submit field
26
+
27
+ foreach ($all_fields as $fieldname => $fieldvalue) {
28
+ update_option($fieldname,$fieldvalue);
29
+ }
30
+
31
+ $GLOBALS['honeypot_field_name'] = get_option('honeypot_field_name');
32
+ $GLOBALS['honeypot_error_message'] = get_option('honeypot_error_message');
33
+
34
+ $return['status'] = 'ok';
35
+ $return['body'] = 'Settings Saved';
36
+ return $return;
37
+ }
includes/integration/hp_bbpress.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* BB PRESS */
3
+ add_action( 'bbp_new_topic_pre_extras','hp_bbp_extra_validation');
4
+ add_action( 'bbp_new_reply_pre_extras','hp_bbp_extra_validation');
5
+
6
+ function hp_bbp_extra_validation(){
7
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
8
+ do_action('hp_handle_spammers','bbpress');
9
+ bbp_add_error( 'bbp_extra_email', __( $GLOBALS['honeypot_error_message'], 'bbpress' ) );
10
+ }
11
+ }
includes/integration/hp_contactform7.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_filter( 'wpcf7_validate', 'hp_contactform7_extra_validation', 10, 2 );
3
+
4
+ function hp_contactform7_extra_validation($result, $tags){
5
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
+ do_action('hp_handle_spammers','contactform7');
7
+ die($GLOBALS['honeypot_error_message']);
8
+ }
9
+ return $result;
10
+ }
includes/integration/hp_gravityforms.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action( 'gform_pre_submission', 'hp_gravityforms_extra_validation');
3
+
4
+ function hp_gravityforms_extra_validation($form){
5
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
+ do_action('hp_handle_spammers','gravityforms');
7
+ die($GLOBALS['honeypot_error_message']);
8
+ }
9
+ }
includes/integration/hp_wpcomment.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // WP Comments
3
+ add_filter( 'preprocess_comment', 'hp_wpcomment_extra_validation' );
4
+
5
+ function hp_wpcomment_extra_validation( $commentdata ) {
6
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
7
+ do_action('hp_handle_spammers','wpcomment');
8
+ wp_die( __( $GLOBALS['honeypot_error_message'] ) );
9
+ }
10
+ return $commentdata;
11
+ }
includes/integration/hp_wpforms.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_filter( 'wpforms_process_before', 'hp_wpforms_extra_validation', 10, 2 );
3
+
4
+ function hp_wpforms_extra_validation($entry, $form_data){
5
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
+ do_action('hp_handle_spammers','wpforms');
7
+ wpforms()->process->errors[ $form_data['id'] ][ '0' ] = $GLOBALS['honeypot_error_message'];
8
+ }
9
+ }
includes/integration/hp_wpregistration.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_filter( 'registration_errors', 'hp_wpregistration_extra_validation', 10, 3 );
3
+
4
+ function hp_wpregistration_extra_validation( $errors, $sanitized_user_login, $user_email ) {
5
+ if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
+ do_action('hp_handle_spammers','wpregistration');
7
+ $errors->add( 'hp_extra_email', __($GLOBALS['honeypot_error_message']) );
8
+ }
9
+ return $errors;
10
+ }
includes/js/hp.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ //alert('2');
4
+
5
+ jQuery('.bbp-topic-form form').append(honeypot_hidden_field); // BBPRESS TOPIC
6
+ jQuery('.bbp-reply-form form').append(honeypot_hidden_field); // BBPRESS REPLY
7
+ jQuery('form#commentform').append(honeypot_hidden_field); // WP COMMENT
8
+ jQuery('form#registerform').append(honeypot_hidden_field); // WP REGISTRATION
9
+ jQuery('form.wpcf7-form').append(honeypot_hidden_field); // CONTACT FORM 7
10
+ jQuery('form.wpforms-form').append(honeypot_hidden_field); // WPFFORMS
11
+
12
+ jQuery('.gform_wrapper form').append(honeypot_hidden_field); // GRAVITY FORMS
13
+
14
+
15
+
16
+
17
+ });
18
+
19
+
includes/views/hp_extended_version.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ .why_extended{padding: 10px; font-size: 14px;}
3
+ .why_extended ul li{ padding-bottom: 20px; width: 285px; float: left; margin:10px 20px 10px 0px;border: 1px solid #d0d0d0; background: #d8d8d8; height: 110px; border-radius: 5px; padding: 10px; line-height: 1.5;}
4
+ .why_extended ul label{display: block;padding-bottom: 10px; font-size: 15px; color: #000; font-weight: 500;}
5
+ </style>
6
+ <div class="why_extended">
7
+ <h3>Extra Tools that HoneyPot Extended offers to make HoneyPot more powerfull.</h3>
8
+ <ul>
9
+ <li><label>Spam Prevention Statistics</label>
10
+ Numerical stats and graph Visualization of spam bots.
11
+ </li>
12
+
13
+ <li><label>Record Spammer IP</label>
14
+ Can record Spammer IPs. Usefull if you want them to block for further submission.
15
+ </li>
16
+
17
+ <li><label>View Spam Submission</label>
18
+ See what data spam bot was trying to submit.
19
+ </li>
20
+
21
+ <li><label>Auto Block Spam Bot IP</label>
22
+ Allows you to block the spam bot IP so that they can't visit your website.
23
+ </li>
24
+
25
+ <li><label>Get HoneyPot Extended Now !</label>
26
+ Get HoneyPot Extended and make HoneyPot more powerfull.
27
+ <br/>
28
+ <a href="https://bit.ly/2CdkfqR" target="_blank" class="button" style="float: right;">GET IT NOW</a>
29
+ </li>
30
+
31
+ <li><label>Don't need HoneyPot Extended Tools ?</label>
32
+ In long run Spam bot learns to bypass the protection. So implementing new method is must. You can motivate us using the HoneyPot Extended.
33
+ </li>
34
+
35
+
36
+ </ul>
37
+ </div>
includes/views/hp_main.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (isset($_POST['submit-hp-general-settings'])){
3
+ $saveReturn = hp_save_settings();
4
+ }
5
+
6
+ if (isset($_GET['tab'])){
7
+ $currentTab = $_GET['tab'];
8
+ } else {
9
+ $currentTab = 'settings';
10
+ }
11
+ ?>
12
+
13
+ <?php if (isset($saveReturn)):?>
14
+ <div class="updated <?php echo $saveReturn['status']; ?>" id="message"><p><?php echo $saveReturn['body']; ?></p></div>
15
+ <?php endif; ?>
16
+
17
+ <div class="wrap">
18
+
19
+
20
+ <h1>Honey Pot</h1>
21
+
22
+ <nav class="nav-tab-wrapper">
23
+ <?php foreach ($hp_tabs as $tabKey => $tabData) { ?>
24
+ <a href="?page=honeypot&tab=<?php echo $tabKey; ?>" class="nav-tab <?php echo $currentTab == $tabKey?'nav-tab-active':''; ?>"><?php echo $tabData['name']; ?></a>
25
+ <?php } ?>
26
+ </nav>
27
+
28
+ <div class="tab-content">
29
+ <table width="100%">
30
+ <tr>
31
+ <td valign="top">
32
+ <?php include($hp_tabs[$currentTab]['path']); ?>
33
+ </td>
34
+ <td width="15">&nbsp;</td>
35
+ <td width="250" valign="top"><?php include('hp_sidebar.php'); ?></td>
36
+ </tr>
37
+ </table>
38
+ </div>
39
+
40
+ </div>
includes/views/hp_settings.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <br/>
2
+ <table class="wp-list-table widefat">
3
+ <thead>
4
+ <tr>
5
+ <th colspan="2"><strong>General Settings</strong></th>
6
+ </tr>
7
+ </thead>
8
+ <tbody>
9
+ <tr>
10
+ <td colspan="2"><strong>There is no much settings to mess with. This plugin should work fine with default settings.</strong></td>
11
+ </tr>
12
+
13
+ <form method="post" action="">
14
+ <tr>
15
+ <td width="250">Honey Pot Field Name</td>
16
+ <td>
17
+ <input name="honeypot_field_name" style="width:300px;" value="<?php echo get_option('honeypot_field_name');?>" type="text" /><br/>
18
+ <em>Changing the field name regularly is a good idea. Should definately do if you are getting spam.</em>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td>Honey Pot Error Message</td>
23
+ <td>
24
+ <input name="honeypot_error_message" style="width:300px;" value="<?php echo get_option('honeypot_error_message');?>" type="text" /><br/><em>Mesage for bots. No average human users will see though.</em>
25
+ </td>
26
+ </tr>
27
+
28
+ <tr>
29
+ <td colspan="2"><input type="submit" name="submit-hp-general-settings" class="button-primary" value="Save General Settings" /></td>
30
+ </tr>
31
+ </form>
32
+
33
+ </tbody>
34
+ </table><br/>
35
+
36
+
37
+ <table class="wp-list-table widefat">
38
+ <thead>
39
+ <tr>
40
+ <th colspan="2"><strong>HoneyPot Extended Settings</strong></th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <tr>
45
+ <td colspan="2"><strong>HoneyPot Extended Settings that work once Honey Extended is active. Not needed for spam prevention to work. But very helpfull additionals tools and good to have.</strong></td>
46
+ </tr>
47
+ <form method="post" action="">
48
+
49
+ <tr>
50
+ <td width="250">Enable Stats</td>
51
+ <td>
52
+ <?php $honeypot_enable_stats = get_option('honeypot_enable_stats'); ?>
53
+ <select name="honeypot_enable_stats">
54
+ <option value="yes" <?php echo $honeypot_enable_stats == 'yes'?'selected="selected"':''; ?>>Yes</option>
55
+ <option value="no" <?php echo $honeypot_enable_stats == 'no'?'selected="selected"':''; ?>>No</option>
56
+ </select>
57
+ </td>
58
+ </tr>
59
+
60
+ <tr>
61
+ <td>Log Spammer IP</td>
62
+ <td>
63
+ <?php $honeypot_log_spammer_ip = get_option('honeypot_log_spammer_ip'); ?>
64
+ <select name="honeypot_log_spammer_ip">
65
+ <option value="no" <?php echo $honeypot_log_spammer_ip == 'no'?'selected="selected"':''; ?>>No</option>
66
+ <option value="yes" <?php echo $honeypot_log_spammer_ip == 'yes'?'selected="selected"':''; ?>>Yes</option>
67
+ </select>
68
+ </td>
69
+
70
+ </tr>
71
+
72
+ <tr>
73
+ <td>Log Spam Submission</td>
74
+ <td>
75
+ <?php $honeypot_log_spam_data = get_option('honeypot_log_spam_data'); ?>
76
+ <select name="honeypot_log_spam_data">
77
+ <option value="no" <?php echo $honeypot_log_spam_data == 'no'?'selected="selected"':''; ?>>No</option>
78
+ <option value="yes" <?php echo $honeypot_log_spam_data == 'yes'?'selected="selected"':''; ?>>Yes</option>
79
+ </select>
80
+ <br/><em><strong>Want to know what Spammer tried to post ? Enable this.</strong></em>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr>
85
+ <td>Auto Block IP after </td>
86
+ <td>
87
+ <?php $honeypot_auto_block_ip = get_option('honeypot_auto_block_ip'); ?>
88
+ <select name="honeypot_auto_block_ip">
89
+ <option value="no" <?php echo $honeypot_auto_block_ip == 'no'?'selected="selected"':''; ?>>Don't Block</option>
90
+ <option value="2" <?php echo $honeypot_auto_block_ip == '2'?'selected="selected"':''; ?>>After 2 Spam Submissions</option>
91
+ <option value="5" <?php echo $honeypot_auto_block_ip == '5'?'selected="selected"':''; ?>>After 5 Spam Submissions</option>
92
+ <option value="10" <?php echo $honeypot_auto_block_ip == '10'?'selected="selected"':''; ?>>After 10 Spam Submissions</option>
93
+ </select><br/>
94
+ <em><strong>Blocking IP will make site inaccessible for that user. Must enable Log Spammer IP to work.</strong></em>
95
+ </td>
96
+ </tr>
97
+
98
+ <tr>
99
+ <td colspan="2"><input type="submit" name="submit-hp-general-settings" class="button-primary" value="Save Extended Settings" /></td>
100
+ </tr>
101
+ </form>
102
+
103
+ </tbody>
104
+ </table><br/>
includes/views/hp_sidebar.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ ul.uaf_list{ list-style-type:square;margin-left: 2em;}
3
+ </style>
4
+ <br/>
5
+
6
+ <table class="wp-list-table widefat fixed bookmarks">
7
+ <thead>
8
+ <tr>
9
+ <th><strong>Quick Link</strong></th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <tr>
14
+ <td>
15
+ <ul class="uaf_list">
16
+ <li><a href=" https://dineshkarki.com.np/forums/forum/honeypot" target="_blank">Support Forum</a></li>
17
+ <li><a href="https://www.facebook.com/Dnesscarkey-77553779916" target="_blank">Send Us Msg via Facebook</a></li>
18
+ <li><a href="https://bit.ly/2CdkfqR" target="_blank">Get HoneyPot Extended</a></li>
19
+ </ul>
20
+ </td>
21
+ </tr>
22
+ </tbody>
23
+ </table>
24
+ <br/>
25
+
26
+ <table class="wp-list-table widefat fixed bookmarks">
27
+ <thead>
28
+ <tr>
29
+ <th><strong>Plugins You May Like</strong></th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr>
34
+ <td>
35
+ <ul class="uaf_list">
36
+ <li><a href="https://wordpress.org/plugins/use-any-font/" target="_blank">Use Any Font</a></li>
37
+ <li><a href="https://wordpress.org/plugins/email-checker/" target="_blank">Deliverability Email Validation</a></li>
38
+ <li><a href="http://goo.gl/3XDDzi" target="_blank">WP Masonry Layout</a></li>
39
+ <li><a href="http://wordpress.org/extend/plugins/any-mobile-theme-switcher/" target="_blank">Any Mobile Theme Switcher</a></li>
40
+ <li><a href="http://wordpress.org/extend/plugins/jquery-validation-for-contact-form-7/" target="_blank">Jquery Validation For Contact Form 7</a></li>
41
+ <li><a href="http://wordpress.org/extend/plugins/add-tags-and-category-to-page/" target="_blank">Add Tags And Category To Page</a></li>
42
+ <li><a href="http://wordpress.org/extend/plugins/block-specific-plugin-updates/" target="_blank">Block Specific Plugin Updates</a></li>
43
+ <li><a href="http://wordpress.org/extend/plugins/featured-image-in-rss-feed/" target="_blank">Featured Image In RSS Feed</a></li>
44
+ <li><a href="http://wordpress.org/extend/plugins/remove-admin-bar-for-client/" target="_blank">Remove Admin Bar</a></li>
45
+ </ul>
46
+ </td>
47
+ </tr>
48
+ </tbody>
49
+ </table>
50
+ <br/>
readme.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === HoneyPot Anti Spam ===
2
+ Contributors: dnesscarkey
3
+ Tags: anti-spam, block spam, gravity forms, bbpress, contact form 7,
4
+ Requires at least: 3.0
5
+ Tested up to: 5.4.2
6
+ Stable tag: 1.0
7
+ License: GPLv2 or later
8
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ Uses Honepot revised technic to block spam bots effectively in Comments, Registration, BBPress Forums, Contact Form 7, Gravity Forms, Ninja Forms.
11
+
12
+ == Description ==
13
+ This plugins blocks spam bot submission using HoneyPot Technic. No Captcha or extra verification field hassle to the users. Only lets spam bots to suffer.
14
+
15
+ <strong>What is HoneyPot ? </strong>
16
+ As of now spam bots are unable to handle javascript and we exploit this point to add an extra fields to your forms. Since spam bots are not able to see that field, we check if that field exists or not. If that field doesn't exists we will block the spam submission.
17
+
18
+ <strong>It works with </strong>
19
+
20
+ * BBPress
21
+ * WP Comments
22
+ * WP Registraton
23
+ * BBPress Forum
24
+ * Contact Form 7
25
+ * Ninja Forms
26
+ * Gravity Forms
27
+ * Wp Forms
28
+
29
+
30
+ == Installation ==
31
+
32
+ 1. Install the plugin and activate it. That's all it is needed.
33
+
34
+ == Frequently Asked Questions ==
35
+
36
+ = Forms i am using is not supported. Can you help ? =
37
+
38
+ Ya, Please write to us and we will add support to it.
39
+
40
+ == Changelog ==
41
+
42
+ = = 1.0 =
43
+ * First Release