Changeset 2114528
- Timestamp:
- 06/29/2019 03:09:38 AM (7 years ago)
- Location:
- search-limiter-blocker/trunk
- Files:
-
- 3 edited
-
readme.md (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
search-limiter-blocker.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
search-limiter-blocker/trunk/readme.md
r2114526 r2114528 33 33 ## Changelog 34 34 35 ### 1.1 36 Search bots excluded from IP ban by default 37 35 38 ### 1.0 36 39 Inıtial Release … … 38 41 ## Upgrade Notice 39 42 40 ### 0.143 ### 1.0 41 44 Initial Release. No Upgrade Notice -
search-limiter-blocker/trunk/readme.txt
r2114526 r2114528 27 27 28 28 == Changelog == 29 = 1.1 = 30 Search bots excluded from IP ban by default 31 29 32 = 1.0 = 30 33 Inıtial Release 31 34 32 35 == Upgrade Notice == 33 = 0.1=36 = 1.0 = 34 37 Initial Release. No Upgrade Notice -
search-limiter-blocker/trunk/search-limiter-blocker.php
r2114526 r2114528 5 5 Plugin URI: http://www.wpadami.com/ 6 6 Description: Set and limit search count of visitors. Also, you can block visitor IP. 7 Version: 1. 07 Version: 1.1 8 8 Author: Serkan Algur 9 9 Author URI: http://www.wpadami.com … … 38 38 <h2>Search Limiter & Blocker</h2> 39 39 <p></p> 40 <?php settings_errors(); ?>40 <?php settings_errors(); ?> 41 41 42 42 <form method="post" action="options.php"> 43 <?php43 <?php 44 44 settings_fields( 'search_limiter_blocker_option_group' ); 45 45 do_settings_sections( 'search-limiter-blocker-admin' ); 46 46 submit_button(); 47 ?>47 ?> 48 48 </form> 49 49 </div> 50 <?php50 <?php 51 51 } 52 52 … … 161 161 $will_deleted = get_option( 'visitor_ip_block' . $this->get_the_user_ip() . '-deleteafter30min' ); 162 162 163 // Check for block 164 if ( 'blocked' === $is_block ) : 165 // Kill The Proccess 166 wp_die( esc_html( $message_for_blocked_visitor_2 ), 'You are Blocked By Search Limiter & Blocker for ' . esc_html( $time_for_block ) . ' seconds', 403 ); 167 else : 168 // Not Blocked. Continue as normal 169 if ( $query->is_search ) : 170 if ( ( $visitor_i_p_count >= $visitor_i_p_limit ) && 'yes' === $will_deleted ) : 171 delete_option( 'visitor_ip_count-' . $this->get_the_user_ip() ); 172 delete_option( 'visitor_ip_block' . $this->get_the_user_ip() . '-deleteafter30min' ); 163 if ( preg_match( '/google|yandex|yndx|spider|bot|slurp|msn|bing|adsbot|AdIdxBot|search|face|baidu|duck|sogou|youdao|ccbot|alexa|microsoft/i', gethostbyaddr( $this->get_the_user_ip() ) ) ) { 164 // Search Bots Excluded by default 165 return $query; 166 } else { 173 167 174 // Check for limit again and add one more. 175 elseif ( $visitor_i_p_count < $visitor_i_p_limit ) : 176 $visitor_i_p_count++; 177 update_option( 'visitor_ip_count-' . $this->get_the_user_ip(), $visitor_i_p_count ); 178 return $query; 168 // Check for block 169 if ( 'blocked' === $is_block ) : 170 // Kill The Proccess 171 wp_die( esc_html( $message_for_blocked_visitor_2 ), 'You are Blocked By Search Limiter & Blocker for ' . esc_html( $time_for_block ) . ' seconds', 403 ); 179 172 else : 180 // Add option for block 181 set_transient( 'visitor_ip_block' . $this->get_the_user_ip(), 'blocked', $time_for_block ); 182 update_option( 'visitor_ip_block' . $this->get_the_user_ip() . '-deleteafter30min', 'yes' ); 173 // Not Blocked. Continue as normal 174 if ( $query->is_search ) : 175 if ( ( $visitor_i_p_count >= $visitor_i_p_limit ) && 'yes' === $will_deleted ) : 176 delete_option( 'visitor_ip_count-' . $this->get_the_user_ip() ); 177 delete_option( 'visitor_ip_block' . $this->get_the_user_ip() . '-deleteafter30min' ); 183 178 184 // Kill The Proccess 185 wp_die( esc_html( $message_for_blocked_visitor_2 ), 'You are Blocked By Search Limiter & Blocker for ' . esc_html( $time_for_block ) . ' seconds', 403 ); 179 // Check for limit again and add one more. 180 elseif ( $visitor_i_p_count < $visitor_i_p_limit ) : 181 $visitor_i_p_count++; 182 update_option( 'visitor_ip_count-' . $this->get_the_user_ip(), $visitor_i_p_count ); 183 return $query; 184 else : 185 // Add option for block 186 set_transient( 'visitor_ip_block' . $this->get_the_user_ip(), 'blocked', $time_for_block ); 187 update_option( 'visitor_ip_block' . $this->get_the_user_ip() . '-deleteafter30min', 'yes' ); 188 189 // Kill The Proccess 190 wp_die( esc_html( $message_for_blocked_visitor_2 ), 'You are Blocked By Search Limiter & Blocker for ' . esc_html( $time_for_block ) . ' seconds', 403 ); 191 endif; 192 endif; 186 193 endif; 187 endif; 188 endif; 194 } 189 195 } 190 191 192 196 193 197 }
Note: See TracChangeset
for help on using the changeset viewer.