}
    }
}
//End if block
if (isset($_POST['aiowps_wp_submit_unlock_request'])) {
    //This catches the $_POST when someone submits the form from our special unlock request page where visitor enters email address
    $errors = '';
    $email = trim($_POST['aiowps_unlock_request_email']);
    if (empty($email) || !is_email($email)) {
        $errors .= '<p>' . __('Please enter a valid email address', 'all-in-one-wp-security-and-firewall') . '</p>';
    }
    if ($errors) {
        $display_form = true;
        echo '<div id="login_error">' . $errors . '</div>';
        $sanitized_email = sanitize_email($email);
        echo display_unlock_form($sanitized_email);
    } else {
        $locked_user = get_user_by('email', $email);
        if (!$locked_user) {
            //user with this email does not exist in the system
            $errors .= '<p>' . __('User account not found!', 'all-in-one-wp-security-and-firewall') . '</p>';
            echo '<div id="login_error">' . $errors . '</div>';
        } else {
            //Process unlock request
            //Generate a special code and unlock url
            $ip = AIOWPSecurity_Utility_IP::get_user_ip_address();
            //Get the IP address of user
            $ip_range = AIOWPSecurity_Utility_IP::get_sanitized_ip_range($ip);
            //Get the IP range of the current user
            $unlock_url = AIOWPSecurity_User_Login::generate_unlock_request_link($ip_range);
            if (!$unlock_url) {
            echo display_unlock_form();
        }
    }
}
//End if block
if (isset($_POST['aiowps_wp_submit_unlock_request'])) {
    //This catches the $_POST when someone submits the form from our special unlock request page where visitor enters email address
    $errors = '';
    $email = trim($_POST['aiowps_unlock_request_email']);
    if (empty($email) || !is_email($email)) {
        $errors .= '<p>' . __('Please enter a valid email address', 'aiowpsecurity') . '</p>';
    }
    if ($errors) {
        $display_form = true;
        echo '<div id="login_error">' . $errors . '</div>';
        echo display_unlock_form($email);
    } else {
        $locked_user = get_user_by('email', $email);
        if (!$locked_user) {
            //user with this email does not exist in the system
            $errors .= '<p>' . __('User account not found!', 'aiowpsecurity') . '</p>';
            echo '<div id="login_error">' . $errors . '</div>';
        } else {
            //Process unlock request
            //Generate a special code and unlock url
            $ip = AIOWPSecurity_Utility_IP::get_user_ip_address();
            //Get the IP address of user
            $ip_range = AIOWPSecurity_Utility_IP::get_sanitized_ip_range($ip);
            //Get the IP range of the current user
            $unlock_url = AIOWPSecurity_User_Login::generate_unlock_request_link($ip_range);
            if (!$unlock_url) {