siteguard-login-history-table.php
11 years ago
siteguard-menu-admin-filter.php
11 years ago
siteguard-menu-captcha.php
11 years ago
siteguard-menu-dashboard.php
11 years ago
siteguard-menu-disable-pingback.php
11 years ago
siteguard-menu-fail-once.php
11 years ago
siteguard-menu-init.php
11 years ago
siteguard-menu-login-lock.php
11 years ago
siteguard-menu-rename-login.php
11 years ago
siteguard-menu-same-error.php
11 years ago
siteguard-menu-waf-tuning-support.php
11 years ago
siteguard-waf-exclude-rule-table.php
11 years ago
siteguard-menu-fail-once.php
85 lines
| 1 | <?php |
| 2 | |
| 3 | class SiteGuard_Menu_Fail_Once extends SiteGuard_Base { |
| 4 | function __construct( ) { |
| 5 | $this->render_page( ); |
| 6 | } |
| 7 | function render_page( ) { |
| 8 | global $config; |
| 9 | |
| 10 | $opt_name_fail_once = 'loginlock_fail_once'; |
| 11 | $opt_name_admin_only = 'fail_once_admin_only'; |
| 12 | |
| 13 | $opt_val_fail_once = $config->get( $opt_name_fail_once ); |
| 14 | $opt_val_admin_only = $config->get( $opt_name_admin_only ); |
| 15 | if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-fail-once-submit' ) ) { |
| 16 | $error = false; |
| 17 | if ( false == $this->is_switch_value( $_POST[ $opt_name_fail_once ] ) ) { |
| 18 | echo '<div class="error settings-error"><p><strong>'; |
| 19 | esc_html_e( 'ERROR: Invalid input value.', 'siteguard' ); |
| 20 | echo '</strong></p></div>'; |
| 21 | $error = true; |
| 22 | } |
| 23 | if ( false == $error ) { |
| 24 | $opt_val_fail_once = $_POST[ $opt_name_fail_once ]; |
| 25 | if ( isset( $_POST[ $opt_name_admin_only ] ) ) { |
| 26 | $opt_val_admin_only = $_POST[ $opt_name_admin_only ]; |
| 27 | } else { |
| 28 | $opt_val_admin_only = '0'; |
| 29 | } |
| 30 | $config->set( $opt_name_fail_once, $opt_val_fail_once ); |
| 31 | $config->set( $opt_name_admin_only, $opt_val_admin_only ); |
| 32 | $config->update( ); |
| 33 | ?> |
| 34 | <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div> |
| 35 | <?php |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | echo '<div class="wrap">'; |
| 40 | echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />'; |
| 41 | echo '<h2>' . esc_html__( 'Fail once', 'siteguard' ) . '</h2>'; |
| 42 | ?> |
| 43 | <form name="form1" method="post" action=""> |
| 44 | <table class="form-table"> |
| 45 | <tr> |
| 46 | <th scope="row"><?php esc_html_e( 'Enable/Disable', 'siteguard' ) ?></th> |
| 47 | <td> |
| 48 | <ul class="siteguard-radios"> |
| 49 | <li> |
| 50 | <input type="radio" name="<?php echo $opt_name_fail_once ?>" id="<?php echo $opt_name_fail_once.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_fail_once ? 'checked' : '') ?> > |
| 51 | <label for="<?php echo $opt_name_fail_once.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label> |
| 52 | </li><li> |
| 53 | <input type="radio" name="<?php echo $opt_name_fail_once ?>" id="<?php echo $opt_name_fail_once.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_fail_once ? 'checked' : '') ?> > |
| 54 | <label for="<?php echo $opt_name_fail_once.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label> |
| 55 | </li> |
| 56 | </ul> |
| 57 | </td> |
| 58 | <td> |
| 59 | </tr><tr> |
| 60 | <th scope="row"><?php esc_html_e( 'Target user', 'siteguard' ) ?></th> |
| 61 | <td> |
| 62 | <input type="checkbox" name="<?php echo $opt_name_admin_only ?>" id="<?php echo $opt_name_admin_only ?>" value="1" <?php echo ( '1' == $opt_val_admin_only ? 'checked' : '' ) ?> > |
| 63 | <label for="<?php echo $opt_name_admin_only ?>"><?php esc_html_e( 'Admin only', 'siteguard' ) ?></label> |
| 64 | </td> |
| 65 | </tr> |
| 66 | </table> |
| 67 | <input type="hidden" name="update" value="Y"> |
| 68 | <div class="siteguard-description"> |
| 69 | <?php esc_html_e( 'It is the function to decrease the vulnerability against a password list attack. Even is the login input is correct, the first login must fail. After 5 seconds and later within 60 seconds, another correct login input make login succeed. At the first login failure, the following error message is displayed.', 'siteguard' ); ?> |
| 70 | </div> |
| 71 | <hr /> |
| 72 | |
| 73 | <?php |
| 74 | wp_nonce_field( 'siteguard-menu-fail-once-submit' ); |
| 75 | submit_button( ); |
| 76 | ?> |
| 77 | |
| 78 | </form> |
| 79 | </div> |
| 80 | |
| 81 | <?php |
| 82 | } |
| 83 | } |
| 84 | ?> |
| 85 |