prefix."loginizer_logs`"; $sql[] = "CREATE TABLE `".$wpdb->prefix."loginizer_logs` ( `username` varchar(255) NOT NULL DEFAULT '', `time` int(10) NOT NULL DEFAULT '0', `count` int(10) NOT NULL DEFAULT '0', `lockout` int(10) NOT NULL DEFAULT '0', `ip` varchar(255) NOT NULL DEFAULT '', `url` varchar(255) NOT NULL DEFAULT '', UNIQUE KEY `ip` (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; foreach($sql as $sk => $sv){ $wpdb->query($sv); } add_option('loginizer_version', LOGINIZER_VERSION); add_option('loginizer_options', array()); add_option('loginizer_last_reset', 0); add_option('loginizer_whitelist', array()); add_option('loginizer_blacklist', array()); } // Checks if we are to update ? function loginizer_update_check(){ global $wpdb; $sql = array(); $current_version = get_option('loginizer_version'); // It must be the 1.0 pre stuff if(empty($current_version)){ $current_version = get_option('lz_version'); } $version = (int) str_replace('.', '', $current_version); // No update required if($current_version == LOGINIZER_VERSION){ return true; } // Is it first run ? if(empty($current_version)){ // Reinstall loginizer_activation(); // Trick the following if conditions to not run $version = (int) str_replace('.', '', LOGINIZER_VERSION); } // Is it less than 1.0.1 ? if($version < 101){ // TODO : GET the existing settings // Get the existing settings $lz_failed_logs = lz_selectquery("SELECT * FROM `".$wpdb->prefix."lz_failed_logs`;", 1); $lz_options = lz_selectquery("SELECT * FROM `".$wpdb->prefix."lz_options`;", 1); $lz_iprange = lz_selectquery("SELECT * FROM `".$wpdb->prefix."lz_iprange`;", 1); // Delete the three tables $sql = array(); $sql[] = "DROP TABLE IF EXISTS ".$wpdb->prefix."lz_failed_logs;"; $sql[] = "DROP TABLE IF EXISTS ".$wpdb->prefix."lz_options;"; $sql[] = "DROP TABLE IF EXISTS ".$wpdb->prefix."lz_iprange;"; foreach($sql as $sk => $sv){ $wpdb->query($sv); } // Delete option delete_option('lz_version'); // Reinstall loginizer_activation(); // TODO : Save the existing settings // Update the existing failed logs to new table if(is_array($lz_failed_logs)){ foreach($lz_failed_logs as $fk => $fv){ $wpdb->query("INSERT INTO ".$wpdb->prefix."loginizer_logs SET `username` = '".$fv['username']."', `time` = '".$fv['time']."', `count` = '".$fv['count']."', `lockout` = '".$fv['lockout']."', `ip` = '".$fv['ip']."';"); } } // Update the existing options to new structure if(is_array($lz_options)){ foreach($lz_options as $ok => $ov){ if($ov['option_name'] == 'lz_last_reset'){ update_option('loginizer_last_reset', $ov['option_value']); continue; } $old_option[str_replace('lz_', '', $ov['option_name'])] = $ov['option_value']; } // Save the options update_option('loginizer_options', $old_option); } // Update the existing iprange to new structure if(is_array($lz_iprange)){ $old_blacklist = array(); $old_whitelist = array(); $bid = 1; $wid = 1; foreach($lz_iprange as $ik => $iv){ if(!empty($iv['blacklist'])){ $old_blacklist[$bid] = array(); $old_blacklist[$bid]['start'] = long2ip($iv['start']); $old_blacklist[$bid]['end'] = long2ip($iv['end']); $old_blacklist[$bid]['time'] = strtotime($iv['date']); $bid = $bid + 1; } if(!empty($iv['whitelist'])){ $old_whitelist[$wid] = array(); $old_whitelist[$wid]['start'] = long2ip($iv['start']); $old_whitelist[$wid]['end'] = long2ip($iv['end']); $old_whitelist[$wid]['time'] = strtotime($iv['date']); $wid = $wid + 1; } } if(!empty($old_blacklist)) update_option('loginizer_blacklist', $old_blacklist); if(!empty($old_whitelist)) update_option('loginizer_whitelist', $old_whitelist); } } // Is it less than 1.3.9 ? if($version < 139){ $wpdb->query("ALTER TABLE ".$wpdb->prefix."loginizer_logs ADD `url` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ip`;"); } // Save the new Version update_option('loginizer_version', LOGINIZER_VERSION); // In Sitepad Math Captcha is enabled by default if(defined('SITEPAD') && get_option('loginizer_captcha') === false){ $option['captcha_no_google'] = 1; add_option('loginizer_captcha', $option); } } // Add the action to load the plugin add_action('plugins_loaded', 'loginizer_load_plugin'); // The function that will be called when the plugin is loaded function loginizer_load_plugin(){ global $loginizer; // Check if the installed version is outdated loginizer_update_check(); // Set the array $loginizer = array(); $loginizer['prefix'] = !defined('SITEPAD') ? 'Loginizer ' : 'SitePad '; $loginizer['app'] = !defined('SITEPAD') ? 'WordPress' : 'SitePad'; $loginizer['login_basename'] = !defined('SITEPAD') ? 'wp-login.php' : 'login.php'; $loginizer['wp-includes'] = !defined('SITEPAD') ? 'wp-includes' : 'site-inc'; // The IP Method to use $loginizer['ip_method'] = get_option('loginizer_ip_method'); if($loginizer['ip_method'] == 3){ $loginizer['custom_ip_method'] = get_option('loginizer_custom_ip_method'); } // Load settings $options = get_option('loginizer_options'); $loginizer['max_retries'] = empty($options['max_retries']) ? 3 : $options['max_retries']; $loginizer['lockout_time'] = empty($options['lockout_time']) ? 900 : $options['lockout_time']; // 15 minutes $loginizer['max_lockouts'] = empty($options['max_lockouts']) ? 5 : $options['max_lockouts']; $loginizer['lockouts_extend'] = empty($options['lockouts_extend']) ? 86400 : $options['lockouts_extend']; // 24 hours $loginizer['reset_retries'] = empty($options['reset_retries']) ? 86400 : $options['reset_retries']; // 24 hours $loginizer['notify_email'] = empty($options['notify_email']) ? 0 : $options['notify_email']; // Default messages $loginizer['d_msg']['inv_userpass'] = __('Incorrect Username or Password', 'loginizer'); $loginizer['d_msg']['ip_blacklisted'] = __('Your IP has been blacklisted', 'loginizer'); $loginizer['d_msg']['attempts_left'] = __('attempt(s) left', 'loginizer'); // Message Strings $loginizer['msg'] = get_option('loginizer_msg'); foreach($loginizer['d_msg'] as $lk => $lv){ if(empty($loginizer['msg'][$lk])){ $loginizer['msg'][$lk] = $loginizer['d_msg'][$lk]; } } // Load the blacklist and whitelist $loginizer['blacklist'] = get_option('loginizer_blacklist'); $loginizer['whitelist'] = get_option('loginizer_whitelist'); // When was the database cleared last time $loginizer['last_reset'] = get_option('loginizer_last_reset'); //print_r($loginizer); // Clear retries if((time() - $loginizer['last_reset']) >= $loginizer['reset_retries']){ loginizer_reset_retries(); } $ins_time = get_option('loginizer_ins_time'); if(empty($ins_time)){ $ins_time = time(); update_option('loginizer_ins_time', $ins_time); } $loginizer['ins_time'] = $ins_time; // Set the current IP $loginizer['current_ip'] = lz_getip(); // Is Brute Force Disabled ? $loginizer['disable_brute'] = get_option('loginizer_disable_brute'); // Filters and actions if(empty($loginizer['disable_brute'])){ // Use this to verify before WP tries to login // Is always called and is the first function to be called //add_action('wp_authenticate', 'loginizer_wp_authenticate', 10, 2);// Not called by XML-RPC add_filter('authenticate', 'loginizer_wp_authenticate', 10001, 3);// This one is called by xmlrpc as well as GUI // Is called when a login attempt fails // Hence Update our records that the login failed add_action('wp_login_failed', 'loginizer_login_failed'); // Is called before displaying the error message so that we dont show that the username is wrong or the password // Update Error message add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2); add_action('woocommerce_login_failed', 'loginizer_woocommerce_error_handler', 10001); } // ---------------- // PRO INIT // ---------------- // Email to Login $options = get_option('loginizer_epl'); $loginizer['pl_d_sub'] = 'Login at $site_name'; $loginizer['pl_d_msg'] = 'Hi, A login request was submitted for your account $email at : $site_name - $site_url Login at $site_name by visiting this url : $login_url If you have not requested for the Login URL, please ignore this email. Regards, $site_name'; $loginizer['email_pass_less'] = empty($options['email_pass_less']) ? 0 : $options['email_pass_less']; $loginizer['passwordless_sub'] = empty($options['passwordless_sub']) ? $loginizer['pl_d_sub'] : $options['passwordless_sub']; $loginizer['passwordless_msg'] = empty($options['passwordless_msg']) ? $loginizer['pl_d_msg'] : $options['passwordless_msg']; // For SitePad its always on if(defined('SITEPAD')){ $loginizer['email_pass_less'] = 1; } // Captcha $options = get_option('loginizer_captcha'); $loginizer['captcha_type'] = empty($options['captcha_type']) ? '' : $options['captcha_type']; $loginizer['captcha_key'] = empty($options['captcha_key']) ? '' : $options['captcha_key']; $loginizer['captcha_secret'] = empty($options['captcha_secret']) ? '' : $options['captcha_secret']; $loginizer['captcha_theme'] = empty($options['captcha_theme']) ? 'light' : $options['captcha_theme']; $loginizer['captcha_size'] = empty($options['captcha_size']) ? 'normal' : $options['captcha_size']; $loginizer['captcha_lang'] = empty($options['captcha_lang']) ? '' : $options['captcha_lang']; $loginizer['captcha_user_hide'] = !isset($options['captcha_user_hide']) ? 0 : $options['captcha_user_hide']; $loginizer['captcha_no_css_login'] = !isset($options['captcha_no_css_login']) ? 0 : $options['captcha_no_css_login']; $loginizer['captcha_no_js'] = 1; $loginizer['captcha_login'] = !isset($options['captcha_login']) ? 1 : $options['captcha_login']; $loginizer['captcha_lostpass'] = !isset($options['captcha_lostpass']) ? 1 : $options['captcha_lostpass']; $loginizer['captcha_resetpass'] = !isset($options['captcha_resetpass']) ? 1 : $options['captcha_resetpass']; $loginizer['captcha_register'] = !isset($options['captcha_register']) ? 1 : $options['captcha_register']; $loginizer['captcha_comment'] = !isset($options['captcha_comment']) ? 1 : $options['captcha_comment']; $loginizer['captcha_wc_checkout'] = !isset($options['captcha_wc_checkout']) ? 1 : $options['captcha_wc_checkout']; $loginizer['captcha_no_google'] = !isset($options['captcha_no_google']) ? 0 : $options['captcha_no_google']; $loginizer['captcha_text'] = empty($options['captcha_text']) ? __('Math Captcha', 'loginizer') : $options['captcha_text']; $loginizer['captcha_time'] = empty($options['captcha_time']) ? 300 : $options['captcha_time']; $loginizer['captcha_words'] = !isset($options['captcha_words']) ? 0 : $options['captcha_words']; $loginizer['captcha_add'] = !isset($options['captcha_add']) ? 1 : $options['captcha_add']; $loginizer['captcha_subtract'] = !isset($options['captcha_subtract']) ? 1 : $options['captcha_subtract']; $loginizer['captcha_multiply'] = !isset($options['captcha_multiply']) ? 0 : $options['captcha_multiply']; $loginizer['captcha_divide'] = !isset($options['captcha_divide']) ? 0 : $options['captcha_divide']; // 2fa/question $options = get_option('loginizer_2fa'); $loginizer['2fa_app'] = !isset($options['2fa_app']) ? 0 : $options['2fa_app']; $loginizer['2fa_email'] = !isset($options['2fa_email']) ? 0 : $options['2fa_email']; $loginizer['2fa_email_force'] = !isset($options['2fa_email_force']) ? 0 : $options['2fa_email_force']; $loginizer['2fa_sms'] = !isset($options['2fa_sms']) ? 0 : $options['2fa_sms']; $loginizer['question'] = !isset($options['question']) ? 0 : $options['question']; $loginizer['2fa_default'] = empty($options['2fa_default']) ? 'question' : $options['2fa_default']; $loginizer['2fa_roles'] = empty($options['2fa_roles']) ? array() : $options['2fa_roles']; // Security Settings $options = get_option('loginizer_security'); $loginizer['login_slug'] = empty($options['login_slug']) ? '' : $options['login_slug']; $loginizer['rename_login_secret'] = empty($options['rename_login_secret']) ? '' : $options['rename_login_secret']; $loginizer['xmlrpc_slug'] = empty($options['xmlrpc_slug']) ? '' : $options['xmlrpc_slug']; $loginizer['xmlrpc_disable'] = empty($options['xmlrpc_disable']) ? '' : $options['xmlrpc_disable'];// Disable XML-RPC $loginizer['pingbacks_disable'] = empty($options['pingbacks_disable']) ? '' : $options['pingbacks_disable'];// Disable Pingbacks // Admin Slug Settings $options = get_option('loginizer_wp_admin'); $loginizer['admin_slug'] = empty($options['admin_slug']) ? '' : $options['admin_slug']; $loginizer['restrict_wp_admin'] = empty($options['restrict_wp_admin']) ? '' : $options['restrict_wp_admin']; $loginizer['wp_admin_msg'] = empty($options['wp_admin_msg']) ? '' : $options['wp_admin_msg']; // Checksum Settings $options = get_option('loginizer_checksums'); $loginizer['disable_checksum'] = empty($options['disable_checksum']) ? '' : $options['disable_checksum']; $loginizer['checksum_time'] = empty($options['checksum_time']) ? '' : $options['checksum_time']; $loginizer['checksum_frequency'] = empty($options['checksum_frequency']) ? 7 : $options['checksum_frequency']; $loginizer['no_checksum_email'] = empty($options['no_checksum_email']) ? '' : $options['no_checksum_email']; $loginizer['checksums_last_run'] = get_option('loginizer_checksums_last_run'); // Auto Blacklist Usernames $loginizer['username_blacklist'] = get_option('loginizer_username_blacklist'); $loginizer['domains_blacklist'] = get_option('loginizer_domains_blacklist'); $loginizer['wp_admin_d_msg'] = __('LZ : Not allowed via WP-ADMIN. Please access over the new Admin URL', 'loginizer'); // ---------------- // PRO INIT END // ---------------- // Is the premium features there ? if(file_exists(LOGINIZER_DIR.'/premium.php')){ // Include the file include_once(LOGINIZER_DIR.'/premium.php'); loginizer_security_init(); // Its the free version }else{ // The promo time $loginizer['promo_time'] = get_option('loginizer_promo_time'); if(empty($loginizer['promo_time'])){ $loginizer['promo_time'] = time(); update_option('loginizer_promo_time', $loginizer['promo_time']); } // Are we to show the loginizer promo if(!empty($loginizer['promo_time']) && $loginizer['promo_time'] > 0 && $loginizer['promo_time'] < (time() - (30*24*3600))){ add_action('admin_notices', 'loginizer_promo'); } // Are we to disable the promo if(isset($_GET['loginizer_promo']) && (int)$_GET['loginizer_promo'] == 0){ update_option('loginizer_promo_time', (0 - time()) ); die('DONE'); } } } // Show the promo function loginizer_promo(){ echo '
Dismiss

We are glad you like Loginizer and have been using it since the past few days. It is time to take the next step

Upgrade to Pro Rate it 5★\'s Like Us on Facebook Tweet about Loginizer

'; } // Should return NULL if everything is fine function loginizer_wp_authenticate($user, $username, $password){ global $loginizer, $lz_error, $lz_cannot_login, $lz_user_pass; if(!empty($username) && !empty($password)){ $lz_user_pass = 1; } // Are you whitelisted ? if(loginizer_is_whitelisted()){ $loginizer['ip_is_whitelisted'] = 1; return $user; } // Are you blacklisted ? if(loginizer_is_blacklisted()){ $lz_cannot_login = 1; return new WP_Error('ip_blacklisted', implode('', $lz_error), 'loginizer'); } // Is the username blacklisted ? if(function_exists('loginizer_user_blacklisted')){ if(loginizer_user_blacklisted($username)){ $lz_cannot_login = 1; return new WP_Error('user_blacklisted', implode('', $lz_error), 'loginizer'); } } if(loginizer_can_login()){ return $user; } $lz_cannot_login = 1; return new WP_Error('ip_blocked', implode('', $lz_error), 'loginizer'); } function loginizer_can_login(){ global $wpdb, $loginizer, $lz_error; // Get the logs $result = lz_selectquery("SELECT * FROM `".$wpdb->prefix."loginizer_logs` WHERE `ip` = '".$loginizer['current_ip']."';"); if(!empty($result['count']) && ($result['count'] % $loginizer['max_retries']) == 0){ // Has he reached max lockouts ? if($result['lockout'] >= $loginizer['max_lockouts']){ $loginizer['lockout_time'] = $loginizer['lockouts_extend']; } // Is he in the lockout time ? if($result['time'] >= (time() - $loginizer['lockout_time'])){ $banlift = ceil((($result['time'] + $loginizer['lockout_time']) - time()) / 60); //echo 'Current Time '.date('d/M/Y H:i:s P', time()).'
'; //echo 'Last attempt '.date('d/M/Y H:i:s P', $result['time']).'
'; //echo 'Unlock Time '.date('d/M/Y H:i:s P', $result['time'] + $loginizer['lockout_time']).'
'; $_time = $banlift.' minute(s)'; if($banlift > 60){ $banlift = ceil($banlift / 60); $_time = $banlift.' hour(s)'; } $lz_error['ip_blocked'] = __('You have exceeded maximum login retries
Please try after', 'loginizer').' '.$_time; return false; } } return true; } function loginizer_is_blacklisted(){ global $wpdb, $loginizer, $lz_error; $blacklist = $loginizer['blacklist']; foreach($blacklist as $k => $v){ // Is the IP in the blacklist ? if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){ $result = 1; break; } // Is it in a wider range ? if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){ // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi, // if the current IP is <= than the start of the range, it is within the range // OR // if the current IP is <= than the end of the range, it is within the range if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){ $result = 1; break; } } } // You are blacklisted if(!empty($result)){ $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted']; return true; } return false; } function loginizer_is_whitelisted(){ global $wpdb, $loginizer, $lz_error; $whitelist = $loginizer['whitelist']; foreach($whitelist as $k => $v){ // Is the IP in the blacklist ? if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){ $result = 1; break; } // Is it in a wider range ? if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){ // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi, // if the current IP is <= than the start of the range, it is within the range // OR // if the current IP is <= than the end of the range, it is within the range if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){ $result = 1; break; } } } // You are whitelisted if(!empty($result)){ return true; } return false; } // When the login fails, then this is called // We need to update the database function loginizer_login_failed($username, $is_2fa = ''){ global $wpdb, $loginizer, $lz_cannot_login; $fail_type = 'Login'; if(!empty($is_2fa)){ $fail_type = '2FA'; } if(empty($lz_cannot_login) && empty($loginizer['ip_is_whitelisted']) && empty($loginizer['no_loginizer_logs'])){ $url = @addslashes((!empty($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); $url = esc_url($url); $result = lz_selectquery("SELECT * FROM `".$wpdb->prefix."loginizer_logs` WHERE `ip` = '".$loginizer['current_ip']."';"); if(!empty($result)){ $lockout = floor((($result['count']+1) / $loginizer['max_retries'])); $sresult = $wpdb->query("UPDATE `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = `count`+1, `lockout` = '".$lockout."', `url` = '".$url."' WHERE `ip` = '".$loginizer['current_ip']."';"); // Do we need to email admin ? if(!empty($loginizer['notify_email']) && $lockout >= $loginizer['notify_email']){ $sitename = lz_is_multisite() ? get_site_option('site_name') : get_option('blogname'); $mail = array(); $mail['to'] = lz_is_multisite() ? get_site_option('admin_email') : get_option('admin_email'); $mail['subject'] = 'Failed '.$fail_type.' Attempts from IP '.$loginizer['current_ip'].' ('.$sitename.')'; $mail['message'] = 'Hi, '.($result['count']+1).' failed '.strtolower($fail_type).' attempts and '.$lockout.' lockout(s) from IP '.$loginizer['current_ip'].' Last '.$fail_type.' Attempt : '.date('d/M/Y H:i:s P', time()).' Last User Attempt : '.$username.' IP has been blocked until : '.date('d/M/Y H:i:s P', time() + $loginizer['lockout_time']).' Regards, Loginizer'; @wp_mail($mail['to'], $mail['subject'], $mail['message']); } }else{ $insert = $wpdb->query("INSERT INTO `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = '1', `ip` = '".$loginizer['current_ip']."', `lockout` = '0', `url` = '".$url."';"); } // We need to add one as this is a failed attempt as well $result['count'] = $result['count'] + 1; $loginizer['retries_left'] = ($loginizer['max_retries'] - ($result['count'] % $loginizer['max_retries'])); $loginizer['retries_left'] = $loginizer['retries_left'] == $loginizer['max_retries'] ? 0 : $loginizer['retries_left']; } } // Handles the error of the password not being there function loginizer_error_handler($errors, $redirect_to){ global $wpdb, $loginizer, $lz_user_pass, $lz_cannot_login; //echo 'loginizer_error_handler :';print_r($errors->errors);echo '
'; // Remove the empty password error if(is_wp_error($errors)){ $codes = $errors->get_error_codes(); foreach($codes as $k => $v){ if($v == 'invalid_username' || $v == 'incorrect_password'){ $show_error = 1; } } $errors->remove('invalid_username'); $errors->remove('incorrect_password'); } // Add the error if(!empty($lz_user_pass) && !empty($show_error) && empty($lz_cannot_login)){ $errors->add('invalid_userpass', 'ERROR: ' . $loginizer['msg']['inv_userpass']); } // Add the number of retires left as well if(count($errors->get_error_codes()) > 0 && isset($loginizer['retries_left'])){ $errors->add('retries_left', loginizer_retries_left()); } return $errors; } // Handles the error of the password not being there function loginizer_woocommerce_error_handler(){ global $wpdb, $loginizer, $lz_user_pass, $lz_cannot_login; if(function_exists('wc_add_notice')){ wc_add_notice( loginizer_retries_left(), 'error' ); } } // Returns a string with the number of retries left function loginizer_retries_left(){ global $wpdb, $loginizer, $lz_user_pass, $lz_cannot_login; // If we are to show the number of retries left if(isset($loginizer['retries_left'])){ return ''.$loginizer['retries_left'].' '.$loginizer['msg']['attempts_left']; } } function loginizer_reset_retries(){ global $wpdb, $loginizer; $deltime = time() - $loginizer['reset_retries']; $result = $wpdb->query("DELETE FROM `".$wpdb->prefix."loginizer_logs` WHERE `time` <= '".$deltime."';"); update_option('loginizer_last_reset', time()); } add_filter("plugin_action_links_$plugin_loginizer", 'loginizer_plugin_action_links'); // Add settings link on plugin page function loginizer_plugin_action_links($links) { if(!defined('LOGINIZER_PREMIUM')){ $links[] = ''._x('Upgrade', 'Plugin action link label.', 'loginizer').''; } $settings_link = 'Settings'; array_unshift($links, $settings_link); return $links; } add_action('admin_menu', 'loginizer_admin_menu'); // Shows the admin menu of Loginizer function loginizer_admin_menu() { global $wp_version, $loginizer; if(!defined('SITEPAD')){ // Add the menu page add_menu_page(__('Loginizer Dashboard', 'loginizer'), __('Loginizer Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); // Dashboard add_submenu_page('loginizer', __('Loginizer Dashboard', 'loginizer'), __('Dashboard', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); }else{ // Add the menu page add_menu_page(__('Security', 'loginizer'), __('Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_page_security', 'dashicons-shield', 85); // Rename Login add_submenu_page('loginizer', __('Security Settings', 'loginizer'), __('Rename Login', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_page_security'); } // Brute Force add_submenu_page('loginizer', __('Brute Force Settings', 'loginizer'), __('Brute Force', 'loginizer'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_page_brute_force'); // PasswordLess add_submenu_page('loginizer', __($loginizer['prefix'].'PasswordLess Settings', 'loginizer'), __('PasswordLess', 'loginizer'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_page_passwordless'); // Security Settings if(!defined('SITEPAD')){ // Two Factor Auth add_submenu_page('loginizer', __($loginizer['prefix'].' Two Factor Authentication', 'loginizer'), __('Two Factor Auth', 'loginizer'), 'activate_plugins', 'loginizer_2fa', 'loginizer_page_2fa'); } // reCaptcha add_submenu_page('loginizer', __($loginizer['prefix'].'reCAPTCHA Settings', 'loginizer'), __('reCAPTCHA', 'loginizer'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_page_recaptcha'); // Security Settings if(!defined('SITEPAD')){ // Security Settings add_submenu_page('loginizer', __($loginizer['prefix'].'Security Settings', 'loginizer'), __('Security Settings', 'loginizer'), 'activate_plugins', 'loginizer_security', 'loginizer_page_security'); // File Checksums add_submenu_page('loginizer', __('Loginizer File Checksums', 'loginizer'), __('File Checksums', 'loginizer'), 'activate_plugins', 'loginizer_checksums', 'loginizer_page_checksums'); } if(!defined('LOGINIZER_PREMIUM') && !empty($loginizer['ins_time']) && $loginizer['ins_time'] < (time() - (30*24*3600))){ // Go Pro link add_submenu_page('loginizer', __('Loginizer Go Pro', 'loginizer'), __('Go Pro', 'loginizer'), 'activate_plugins', LOGINIZER_PRO_URL); } } // The Loginizer Admin Options Page function loginizer_page_header($title = 'Loginizer'){ global $loginizer; ?>
'; if(!defined('SITEPAD')){ echo ''; } echo '

'.$loginizer['prefix'].$title.'

'.__('Review Loginizer', 'loginizer').'

'; } // The Loginizer Theme footer function loginizer_page_footer(){ if(!loginizer_is_premium()){ echo ''; } echo ' '; if(!defined('SITEPAD')){ if(!defined('LOGINIZER_PREMIUM')){ echo '

Premium Version

Upgrade to the premium version and get the following features :
  • PasswordLess Login
  • Two Factor Auth - Email
  • Two Factor Auth - App
  • Login Challenge Question
  • reCAPTCHA
  • Rename Login Page
  • Disable XML-RPC
  • And many more ...
Upgrade
'; }else{ echo '

Recommendations

We recommed that you enable atleast one of the following security features:
  • Rename Login Page
  • Login Challenge Question
  • reCAPTCHA
  • Two Factor Auth - Email
  • Two Factor Auth - App
  • Change \'admin\' Username
'; } echo '

Easily manage and make professional pages and content with our Pagelayer builder :
  • 30+ Free Widgets
  • 60+ Premium Widgets
  • 400+ Premium Sections
  • Theme Builder
  • WooCommerce Builder
  • Theme Creator and Exporter
  • Form Builder
  • Popup Builder
  • And many more ...
Visit Pagelayer
'; echo '

Manage all your WordPress sites from 1 dashboard :
  • 1-click Admin Access
  • Update WordPress
  • Update Themes
  • Update Plugins
  • Backup your WordPress Site
  • Plugins & Theme Management
  • Post Management
  • And many more ...
Visit wpCentral
'; } echo '
'; if(!defined('SITEPAD')){ echo '
Let your friends know that you have secured your website :
   


Loginizer v'.LOGINIZER_VERSION.'. You can report any bugs here.'; } echo '
'; } // The Loginizer Admin Options Page function loginizer_page_dashboard(){ global $loginizer, $lz_error, $lz_env; if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } // Dismiss the announcement if(isset($_GET['dismiss_announcement'])){ update_option('loginizer_no_announcement', 1); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } // Is there a license key ? if(isset($_POST['save_lz'])){ $license = lz_optpost('lz_license'); // Check if its a valid license if(empty($license)){ $lz_error['lic_invalid'] = __('The license key was not submitted', 'loginizer'); return loginizer_page_dashboard_T(); } $resp = wp_remote_get(LOGINIZER_API.'license.php?license='.$license, array('timeout' => 30)); if(is_array($resp)){ $json = json_decode($resp['body'], true); //print_r($json); }else{ $lz_error['resp_invalid'] = __('The response was malformed
'.var_export($resp, true), 'loginizer'); return loginizer_page_dashboard_T(); } // Save the License if(empty($json['license'])){ $lz_error['lic_invalid'] = __('The license key is invalid', 'loginizer'); return loginizer_page_dashboard_T(); }else{ update_option('loginizer_license', $json); // Mark as saved $GLOBALS['lz_saved'] = true; } } // Is there a IP Method ? if(isset($_POST['save_lz_ip_method'])){ $ip_method = (int) lz_optpost('lz_ip_method'); $custom_ip_method = lz_optpost('lz_custom_ip_method'); if($ip_method >= 0 && $ip_method <= 3){ update_option('loginizer_ip_method', $ip_method); } // Custom Method name ? if($ip_method == 3){ update_option('loginizer_custom_ip_method', $custom_ip_method); } } loginizer_page_dashboard_T(); } // The Loginizer Admin Options Page - THEME function loginizer_page_dashboard_T(){ global $loginizer, $lz_error, $lz_env; loginizer_page_header('Dashboard'); ?> '. __('We are excited to announce that we have joined forces with Softaculous and have been acquired by them 😊. Read full announcement here.', 'loginizer'). '
'; } echo '
'; // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __('The settings were saved successfully', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } ?>

Welcome to Loginizer Security. By default the Brute Force Protection is immediately enabled. You should start by going over the default settings and tweaking them as per your needs. In the Premium version of Loginizer you have many more features. We recommend you enable features like reCAPTCHA, Two Factor Auth or Email based PasswordLess login. These features will improve your websites security.'; }else{ echo '
Upgrade to Pro for more features like reCAPTCHA, Two Factor Auth, Rename wp-admin and wp-login.php pages, Email based PasswordLess login and more. These features will improve your website\'s security.'; } ?>

'; if(defined('LOGINIZER_PREMIUM')){ echo ' '; } echo ''; if(file_exists(ABSPATH.'/.htaccess')){ echo ' '; } ?>
'.__('Loginizer Version', 'loginizer').' '.LOGINIZER_VERSION.(defined('LOGINIZER_PREMIUM') ? ' (Security PRO Version)' : '').'
'.__('Loginizer License', 'loginizer').' '.(empty($loginizer['license']) ? 'Unlicensed    ' : '').'   '; if(!empty($loginizer['license'])){ $expires = $loginizer['license']['expires']; $expires = substr($expires, 0, 4).'/'.substr($expires, 4, 2).'/'.substr($expires, 6); echo '
License Active : '.(empty($loginizer['license']['active']) ? 'No' : 'Yes').'       License Expires : '.($loginizer['license']['expires'] <= date('Ymd') ? ''.$expires.'' : $expires).'
'; } echo '
'.__('URL', 'loginizer').' '.get_site_url().'
'.__('Path', 'loginizer').' '.ABSPATH.'
'.__('Server\'s IP Address', 'loginizer').' '.@$_SERVER['SERVER_ADDR'].'
'.__('Your IP Address', 'loginizer').' '.lz_getip().'
Method :
'.__('wp-config.php is writable', 'loginizer').' '.(is_writable(ABSPATH.'/wp-config.php') ? 'Yes' : 'No').'
'.__('.htaccess is writable', 'loginizer').' '.(is_writable(ABSPATH.'/.htaccess') ? 'Yes' : 'No').'

'; $wp_content = basename(dirname(dirname(dirname(__FILE__)))); $files_to_check = array('/' => '0755', '/wp-admin' => '0755', '/wp-includes' => '0755', '/wp-config.php' => '0444', '/'.$wp_content => '0755', '/'.$wp_content.'/themes' => '0755', '/'.$wp_content.'/plugins' => '0755', '.htaccess' => '0444'); $root = ABSPATH; foreach($files_to_check as $k => $v){ $path = $root.'/'.$k; $stat = @stat($path); $suggested = $v; $actual = substr(sprintf('%o', $stat['mode']), -4); echo ' '; } ?>
'.__('Relative Path', 'loginizer').' '.__('Suggested', 'loginizer').' '.__('Actual', 'loginizer').'
'.$k.' '.$suggested.' '.$actual.'
0){ check_admin_referer('loginizer-options'); } // BEGIN THEME loginizer_page_header('Brute Force Settings'); // Load the blacklist and whitelist $loginizer['blacklist'] = get_option('loginizer_blacklist'); $loginizer['whitelist'] = get_option('loginizer_whitelist'); // Disable Brute Force if(isset($_POST['disable_brute_lz'])){ // Save the options update_option('loginizer_disable_brute', 1); $loginizer['disable_brute'] = 1; echo '

' . __('The Brute Force Protection feature is now disabled', 'loginizer') . '


'; } // Enable brute force if(isset($_POST['enable_brute_lz'])){ // Save the options update_option('loginizer_disable_brute', 0); $loginizer['disable_brute'] = 0; echo '

' . __('The Brute Force Protection feature is now enabled', 'loginizer') . '


'; } // The Brute Force Settings if(isset($_POST['save_lz'])){ $max_retries = (int) lz_optpost('max_retries'); $lockout_time = (int) lz_optpost('lockout_time'); $max_lockouts = (int) lz_optpost('max_lockouts'); $lockouts_extend = (int) lz_optpost('lockouts_extend'); $reset_retries = (int) lz_optpost('reset_retries'); $notify_email = (int) lz_optpost('notify_email'); $lockout_time = $lockout_time * 60; $lockouts_extend = $lockouts_extend * 60 * 60; $reset_retries = $reset_retries * 60 * 60; if(empty($error)){ $option['max_retries'] = $max_retries; $option['lockout_time'] = $lockout_time; $option['max_lockouts'] = $max_lockouts; $option['lockouts_extend'] = $lockouts_extend; $option['reset_retries'] = $reset_retries; $option['notify_email'] = $notify_email; // Save the options update_option('loginizer_options', $option); $saved = true; }else{ lz_report_error($error); } if(!empty($notice)){ lz_report_notice($notice); } if(!empty($saved)){ echo '

' . __('The settings were saved successfully', 'loginizer') . '


'; } } // Delete a Blackist IP range if(isset($_POST['bdelid'])){ $delid = (int) lz_optreq('bdelid'); // Unset and save $blacklist = $loginizer['blacklist']; unset($blacklist[$delid]); update_option('loginizer_blacklist', $blacklist); echo '

' . __('The Blacklist IP range has been deleted successfully', 'loginizer') . '


'; } // Delete all Blackist IP ranges if(isset($_POST['del_all_blacklist'])){ // Unset and save update_option('loginizer_blacklist', array()); echo '

' . __('The Blacklist IP range(s) have been cleared successfully', 'loginizer') . '


'; } // Delete a Whitelist IP range if(isset($_POST['delid'])){ $delid = (int) lz_optreq('delid'); // Unset and save $whitelist = $loginizer['whitelist']; unset($whitelist[$delid]); update_option('loginizer_whitelist', $whitelist); echo '

' . __('The Whitelist IP range has been deleted successfully', 'loginizer') . '


'; } // Delete all Blackist IP ranges if(isset($_POST['del_all_whitelist'])){ // Unset and save update_option('loginizer_whitelist', array()); echo '

' . __('The Whitelist IP range(s) have been cleared successfully', 'loginizer') . '


'; } // Reset All Logs if(isset($_POST['lz_reset_all_ip'])){ $result = $wpdb->query("DELETE FROM `".$wpdb->prefix."loginizer_logs` WHERE `time` > 0"); echo '

' . __('All the IP Logs have been cleared', 'loginizer') . '


'; } // Reset Logs if(isset($_POST['lz_reset_ips']) && is_array($_POST['lz_reset_ips'])){ $ips = $_POST['lz_reset_ips']; foreach($ips as $ip){ if(!lz_valid_ip($ip)){ $error[] = 'The IP - '.$ip.' is invalid !'; } } if(count($ips) < 1){ $error[] = __('There are no IPs submitted', 'loginizer'); } // Should we start deleting logs if(empty($error)){ $result = $wpdb->query("DELETE FROM `".$wpdb->prefix."loginizer_logs` WHERE `ip` IN ('".implode("', '", $ips)."')"); if(empty($error)){ echo '

' . __('The selected IP Logs have been reset', 'loginizer') . '


'; } } if(!empty($error)){ lz_report_error($error);echo '
'; } } if(isset($_POST['blacklist_iprange'])){ $start_ip = lz_optpost('start_ip'); $end_ip = lz_optpost('end_ip'); if(empty($start_ip)){ $error[] = __('Please enter the Start IP', 'loginizer'); } // If no end IP we consider only 1 IP if(empty($end_ip)){ $end_ip = $start_ip; } if(!lz_valid_ip($start_ip)){ $error[] = __('Please provide a valid start IP', 'loginizer'); } if(!lz_valid_ip($end_ip)){ $error[] = __('Please provide a valid end IP', 'loginizer'); } // Regular ranges will work if(inet_ptoi($start_ip) > inet_ptoi($end_ip)){ // BUT, if 0.0.0.1 - 255.255.255.255 is given, it will not work if(inet_ptoi($start_ip) >= 0 && inet_ptoi($end_ip) < 0){ // This is right }else{ $error[] = __('The End IP cannot be smaller than the Start IP', 'loginizer'); } } if(empty($error)){ $blacklist = $loginizer['blacklist']; foreach($blacklist as $k => $v){ // This is to check if there is any other range exists with the same Start or End IP if(( inet_ptoi($start_ip) <= inet_ptoi($v['start']) && inet_ptoi($v['start']) <= inet_ptoi($end_ip) ) || ( inet_ptoi($start_ip) <= inet_ptoi($v['end']) && inet_ptoi($v['end']) <= inet_ptoi($end_ip) ) ){ $error[] = __('The Start IP or End IP submitted conflicts with an existing IP range !', 'loginizer'); break; } // This is to check if there is any other range exists with the same Start IP if(inet_ptoi($v['start']) <= inet_ptoi($start_ip) && inet_ptoi($start_ip) <= inet_ptoi($v['end'])){ $error[] = __('The Start IP is present in an existing range !', 'loginizer'); break; } // This is to check if there is any other range exists with the same End IP if(inet_ptoi($v['start']) <= inet_ptoi($end_ip) && inet_ptoi($end_ip) <= inet_ptoi($v['end'])){ $error[] = __('The End IP is present in an existing range!', 'loginizer'); break; } } $newid = ( empty($blacklist) ? 0 : max(array_keys($blacklist)) ) + 1; if(empty($error)){ $blacklist[$newid] = array(); $blacklist[$newid]['start'] = $start_ip; $blacklist[$newid]['end'] = $end_ip; $blacklist[$newid]['time'] = time(); update_option('loginizer_blacklist', $blacklist); echo '

' . __('Blacklist IP range added successfully', 'loginizer') . '


'; } } if(!empty($error)){ lz_report_error($error);echo '
'; } } if(isset($_POST['whitelist_iprange'])){ $start_ip = lz_optpost('start_ip_w'); $end_ip = lz_optpost('end_ip_w'); if(empty($start_ip)){ $error[] = __('Please enter the Start IP', 'loginizer'); } // If no end IP we consider only 1 IP if(empty($end_ip)){ $end_ip = $start_ip; } if(!lz_valid_ip($start_ip)){ $error[] = __('Please provide a valid start IP', 'loginizer'); } if(!lz_valid_ip($end_ip)){ $error[] = __('Please provide a valid end IP', 'loginizer'); } if(inet_ptoi($start_ip) > inet_ptoi($end_ip)){ // BUT, if 0.0.0.1 - 255.255.255.255 is given, it will not work if(inet_ptoi($start_ip) >= 0 && inet_ptoi($end_ip) < 0){ // This is right }else{ $error[] = __('The End IP cannot be smaller than the Start IP', 'loginizer'); } } if(empty($error)){ $whitelist = $loginizer['whitelist']; foreach($whitelist as $k => $v){ // This is to check if there is any other range exists with the same Start or End IP if(( inet_ptoi($start_ip) <= inet_ptoi($v['start']) && inet_ptoi($v['start']) <= inet_ptoi($end_ip) ) || ( inet_ptoi($start_ip) <= inet_ptoi($v['end']) && inet_ptoi($v['end']) <= inet_ptoi($end_ip) ) ){ $error[] = __('The Start IP or End IP submitted conflicts with an existing IP range !', 'loginizer'); break; } // This is to check if there is any other range exists with the same Start IP if(inet_ptoi($v['start']) <= inet_ptoi($start_ip) && inet_ptoi($start_ip) <= inet_ptoi($v['end'])){ $error[] = __('The Start IP is present in an existing range !', 'loginizer'); break; } // This is to check if there is any other range exists with the same End IP if(inet_ptoi($v['start']) <= inet_ptoi($end_ip) && inet_ptoi($end_ip) <= inet_ptoi($v['end'])){ $error[] = __('The End IP is present in an existing range!', 'loginizer'); break; } } $newid = ( empty($whitelist) ? 0 : max(array_keys($whitelist)) ) + 1; if(empty($error)){ $whitelist[$newid] = array(); $whitelist[$newid]['start'] = $start_ip; $whitelist[$newid]['end'] = $end_ip; $whitelist[$newid]['time'] = time(); update_option('loginizer_whitelist', $whitelist); echo '

' . __('Whitelist IP range added successfully', 'loginizer') . '


'; } } if(!empty($error)){ lz_report_error($error);echo '
'; } } // Save the messages if(isset($_POST['save_err_msgs_lz'])){ $msgs['inv_userpass'] = lz_optpost('msg_inv_userpass'); $msgs['ip_blacklisted'] = lz_optpost('msg_ip_blacklisted'); $msgs['attempts_left'] = lz_optpost('msg_attempts_left'); // Update them update_option('loginizer_msg', $msgs); echo '

' . __('Error messages were saved successfully', 'loginizer') . '


'; } // Count the Results $tmp = lz_selectquery("SELECT COUNT(*) AS num FROM `".$wpdb->prefix."loginizer_logs`"); //print_r($tmp); // Which Page is it $lz_env['res_len'] = 10; $lz_env['cur_page'] = lz_get_page('lzpage', $lz_env['res_len']); $lz_env['num_res'] = $tmp['num']; $lz_env['max_page'] = ceil($lz_env['num_res'] / $lz_env['res_len']); // Get the logs $result = lz_selectquery("SELECT * FROM `".$wpdb->prefix."loginizer_logs` ORDER BY `time` DESC LIMIT ".$lz_env['cur_page'].", ".$lz_env['res_len']."", 1); //print_r($result); $lz_env['cur_page'] = ($lz_env['cur_page'] / $lz_env['res_len']) + 1; $lz_env['cur_page'] = $lz_env['cur_page'] < 1 ? 1 : $lz_env['cur_page']; $lz_env['next_page'] = ($lz_env['cur_page'] + 1) > $lz_env['max_page'] ? $lz_env['max_page'] : ($lz_env['cur_page'] + 1); $lz_env['prev_page'] = ($lz_env['cur_page'] - 1) < 1 ? 1 : ($lz_env['cur_page'] - 1); // Reload the settings $loginizer['blacklist'] = get_option('loginizer_blacklist'); $loginizer['whitelist'] = get_option('loginizer_whitelist'); $saved_msgs = get_option('loginizer_msg'); ?>

Failed Login Attempts Logs   (Past '.($loginizer['reset_retries']/60/60).' hours)','loginizer'); ?>

'; }else{ foreach($result as $ik => $iv){ $status_button = (!empty($iv['status']) ? 'disable' : 'enable'); echo ' '; } } ?>
#
'.__('No Logs. You will see logs about failed login attempts here.', 'loginizer').'
'.$iv['ip'].' '.$iv['username'].' '.date('d/M/Y H:i:s P', $iv['time']).' '.$iv['count'].' '.$iv['lockout'].' '.$iv['url'].'

   






0 to disable email notifications','loginizer'); ?>

'; }else{ echo ''; } ?>


If you want to blacklist single IP leave this field blank.','loginizer'); ?>

'; }else{ foreach($loginizer['blacklist'] as $ik => $iv){ echo ' '; } } ?>
'.__('No Blacklist IPs. You will see blacklisted IP ranges here.', 'loginizer').'
'.$iv['start'].' '.$iv['end'].' '.date('d/m/Y', $iv['time']).' Delete



If you want to whitelist single IP leave this field blank.','loginizer'); ?>

'; }else{ foreach($loginizer['whitelist'] as $ik => $iv){ echo ' '; } } ?>
'.__('No Whitelist IPs. You will see whitelisted IP ranges here.', 'loginizer').'
'.$iv['start'].' '.$iv['end'].' '.date('d/m/Y', $iv['time']).' Delete

"' . $loginizer['d_msg']['inv_userpass']. '"', 'loginizer'); ?>
"' . $loginizer['d_msg']['ip_blacklisted']. '"', 'loginizer'); ?>
"' . $loginizer['d_msg']['attempts_left']. '"', 'loginizer'); ?>

0){ $lz_error['not_in_free'] = __('This feature is not available in the Free version. Upgrade to Pro', 'loginizer'); return loginizer_page_recaptcha_T(); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } // Themes $lz_env['theme']['light'] = 'Light'; $lz_env['theme']['dark'] = 'Dark'; // Langs $lz_env['lang'][''] = 'Auto Detect'; $lz_env['lang']['ar'] = 'Arabic'; $lz_env['lang']['bg'] = 'Bulgarian'; $lz_env['lang']['ca'] = 'Catalan'; $lz_env['lang']['zh-CN'] = 'Chinese (Simplified)'; $lz_env['lang']['zh-TW'] = 'Chinese (Traditional)'; $lz_env['lang']['hr'] = 'Croatian'; $lz_env['lang']['cs'] = 'Czech'; $lz_env['lang']['da'] = 'Danish'; $lz_env['lang']['nl'] = 'Dutch'; $lz_env['lang']['en-GB'] = 'English (UK)'; $lz_env['lang']['en'] = 'English (US)'; $lz_env['lang']['fil'] = 'Filipino'; $lz_env['lang']['fi'] = 'Finnish'; $lz_env['lang']['fr'] = 'French'; $lz_env['lang']['fr-CA'] = 'French (Canadian)'; $lz_env['lang']['de'] = 'German'; $lz_env['lang']['de-AT'] = 'German (Austria)'; $lz_env['lang']['de-CH'] = 'German (Switzerland)'; $lz_env['lang']['el'] = 'Greek'; $lz_env['lang']['iw'] = 'Hebrew'; $lz_env['lang']['hi'] = 'Hindi'; $lz_env['lang']['hu'] = 'Hungarain'; $lz_env['lang']['id'] = 'Indonesian'; $lz_env['lang']['it'] = 'Italian'; $lz_env['lang']['ja'] = 'Japanese'; $lz_env['lang']['ko'] = 'Korean'; $lz_env['lang']['lv'] = 'Latvian'; $lz_env['lang']['lt'] = 'Lithuanian'; $lz_env['lang']['no'] = 'Norwegian'; $lz_env['lang']['fa'] = 'Persian'; $lz_env['lang']['pl'] = 'Polish'; $lz_env['lang']['pt'] = 'Portuguese'; $lz_env['lang']['pt-BR'] = 'Portuguese (Brazil)'; $lz_env['lang']['pt-PT'] = 'Portuguese (Portugal)'; $lz_env['lang']['ro'] = 'Romanian'; $lz_env['lang']['ru'] = 'Russian'; $lz_env['lang']['sr'] = 'Serbian'; $lz_env['lang']['sk'] = 'Slovak'; $lz_env['lang']['sl'] = 'Slovenian'; $lz_env['lang']['es'] = 'Spanish'; $lz_env['lang']['es-419'] = 'Spanish (Latin America)'; $lz_env['lang']['sv'] = 'Swedish'; $lz_env['lang']['th'] = 'Thai'; $lz_env['lang']['tr'] = 'Turkish'; $lz_env['lang']['uk'] = 'Ukrainian'; $lz_env['lang']['vi'] = 'Vietnamese'; // Sizes $lz_env['size']['normal'] = 'Normal'; $lz_env['size']['compact'] = 'Compact'; if(isset($_POST['save_lz'])){ // Google Captcha $option['captcha_type'] = lz_optpost('captcha_type'); $option['captcha_key'] = lz_optpost('captcha_key'); $option['captcha_secret'] = lz_optpost('captcha_secret'); $option['captcha_theme'] = lz_optpost('captcha_theme'); $option['captcha_size'] = lz_optpost('captcha_size'); $option['captcha_lang'] = lz_optpost('captcha_lang'); // No Google Captcha $option['captcha_text'] = lz_optpost('captcha_text'); $option['captcha_time'] = (int) lz_optpost('captcha_time'); $option['captcha_words'] = (int) lz_optpost('captcha_words'); $option['captcha_add'] = (int) lz_optpost('captcha_add'); $option['captcha_subtract'] = (int) lz_optpost('captcha_subtract'); $option['captcha_multiply'] = (int) lz_optpost('captcha_multiply'); $option['captcha_divide'] = (int) lz_optpost('captcha_divide'); // Checkboxes $option['captcha_user_hide'] = (int) lz_optpost('captcha_user_hide'); $option['captcha_no_css_login'] = (int) lz_optpost('captcha_no_css_login'); $option['captcha_login'] = (int) lz_optpost('captcha_login'); $option['captcha_lostpass'] = (int) lz_optpost('captcha_lostpass'); $option['captcha_resetpass'] = (int) lz_optpost('captcha_resetpass'); $option['captcha_register'] = (int) lz_optpost('captcha_register'); $option['captcha_comment'] = (int) lz_optpost('captcha_comment'); $option['captcha_wc_checkout'] = (int) lz_optpost('captcha_wc_checkout'); // Are we to use Math Captcha ? if(isset($_POST['captcha_no_google'])){ $option['captcha_no_google'] = 1; // Make the checks if(strlen($option['captcha_text']) < 1){ $lz_error['captcha_text'] = __('The Captcha key was not submitted', 'loginizer'); } }else{ // Make the checks if(strlen($option['captcha_key']) < 32 || strlen($option['captcha_key']) > 50){ $lz_error['captcha_key'] = __('The reCAPTCHA key is invalid', 'loginizer'); } // Is secret valid ? if(strlen($option['captcha_secret']) < 32 || strlen($option['captcha_secret']) > 50){ $lz_error['captcha_secret'] = __('The reCAPTCHA secret is invalid', 'loginizer'); } // Is theme valid ? if(empty($lz_env['theme'][$option['captcha_theme']])){ $lz_error['captcha_theme'] = __('The reCAPTCHA theme is invalid', 'loginizer'); } // Is size valid ? if(empty($lz_env['size'][$option['captcha_size']])){ $lz_error['captcha_size'] = __('The reCAPTCHA size is invalid', 'loginizer'); } // Is lang valid ? if(empty($lz_env['lang'][$option['captcha_lang']])){ $lz_error['captcha_lang'] = __('The reCAPTCHA language is invalid', 'loginizer'); } } // Is there an error ? if(!empty($lz_error)){ return loginizer_page_recaptcha_T(); } // Save the options update_option('loginizer_captcha', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Clear this if(isset($_POST['clear_captcha_lz'])){ // Save the options update_option('loginizer_captcha', ''); // Mark as saved $GLOBALS['lz_cleared'] = true; } // Call the theme loginizer_page_recaptcha_T(); } // Loginizer - reCaptcha Page Theme function loginizer_page_recaptcha_T(){ global $loginizer, $lz_error, $lz_env; // Universal header loginizer_page_header('reCAPTCHA Settings'); loginizer_feature_available('reCAPTCHA'); // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __('The settings were saved successfully', 'loginizer'). '


'; } // Cleared ? if(!empty($GLOBALS['lz_cleared'])){ echo '

'. __('reCAPTCHA has been disabled !', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } ?>



See Site Types for more details', 'loginizer'); ?>
name="captcha_type" id="captcha_type_v3" />

name="captcha_type" id="captcha_type_v2" />

name="captcha_type" id="captcha_type_v2_invisible" />


Google', 'loginizer'); ?>

/>



/>

'; ?>
'.__('Addition (+)', 'loginizer').'
'.__('Subtraction (-)', 'loginizer').'
'.__('Multiplication (x)', 'loginizer').'
'.__('Division (รท)', 'loginizer').'
'; if(!defined('SITEPAD')){ echo ''; } ?>
'.__('Login Form', 'loginizer').'
'.__('Lost Password Form', 'loginizer').'
'.__('Reset Password Form', 'loginizer').'
'.__('Registration Form', 'loginizer').'
'.__('Comment Form', 'loginizer').'
'.__('WooCommerce Checkout', 'loginizer').'
/>
/>


0){ $lz_error['not_in_free'] = __('This feature is not available in the Free version. Upgrade to Pro', 'loginizer'); return loginizer_page_2fa_T(); } $lz_roles = get_editable_roles(); /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } // Settings submitted if(isset($_POST['save_lz'])){ // In the future there can be more settings $option['2fa_app'] = (int) lz_optpost('2fa_app'); $option['2fa_email'] = (int) lz_optpost('2fa_email'); $option['question'] = (int) lz_optpost('question'); $option['2fa_email_force'] = (int) lz_optpost('2fa_email_force'); // Any roles to apply to ? foreach($lz_roles as $k => $v){ if(lz_optpost('2fa_roles_'.$k)){ $option['2fa_roles'][$k] = 1; } } // If its all, then blank it if(lz_optpost('2fa_roles_all') || empty($option['2fa_roles'])){ $option['2fa_roles'] = ''; } // Is there an error ? if(!empty($lz_error)){ return loginizer_page_2fa_T(); } // Save the options update_option('loginizer_2fa', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Reset a users 2FA if(isset($_POST['reset_user_lz'])){ $_username = lz_optpost('lz_user_2fa_disable'); // Try to get the user $user_search = get_user_by('login', $_username); // If not found then search by email if(empty($user_search)){ $user_search = get_user_by('email', $_username); } // If not found then give error if(empty($user_search)){ $lz_error['2fa_user_not'] = __('There is no such user with the email or username you submitted', 'loginizer'); return loginizer_page_2fa_T(); } // Get the user prefences $user_pref = get_user_meta($user_search->ID, 'loginizer_user_settings'); // Blank it $user_pref['pref'] = 'none'; // Save it update_user_meta($user_search->ID, 'loginizer_user_settings', $user_pref); // Mark as saved $GLOBALS['lz_saved'] = __('The user\'s 2FA settings have been reset', 'loginizer'); } // Call theme loginizer_page_2fa_T(); } // Loginizer - Two Factor Auth Page function loginizer_page_2fa_T(){ global $loginizer, $lz_error, $lz_env, $lz_roles; // Universal header loginizer_page_header('Two Factor Authentication'); loginizer_feature_available('Two-Factor Authentication'); // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __(is_string($GLOBALS['lz_saved']) ? $GLOBALS['lz_saved'] : 'The settings were saved successfully', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } ?>


Google Authenticator, Authy, etc.', 'loginizer'); ?>
/>

/>

/>


/>

/> All
$v){ echo ' '.$v['name'].'
'; } ?>




0){ $lz_error['not_in_free'] = __('This feature is not available in the Free version. Upgrade to Pro', 'loginizer'); return loginizer_page_passwordless_T(); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } if(isset($_POST['save_lz'])){ // In the future there can be more settings $option['email_pass_less'] = (int) lz_optpost('email_pass_less'); $option['passwordless_sub'] = lz_optpost('lz_passwordless_sub'); $option['passwordless_msg'] = lz_optpost('lz_passwordless_msg'); // Is there an error ? if(!empty($lz_error)){ return loginizer_page_passwordless_T(); } // Save the options update_option('loginizer_epl', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Call theme loginizer_page_passwordless_T(); } // Loginizer - PasswordLess Page Theme function loginizer_page_passwordless_T(){ global $loginizer, $lz_error, $lz_env; $lz_options = get_option('loginizer_epl'); // Universal header loginizer_page_header('PasswordLess Settings'); loginizer_feature_available('PasswordLess Login'); // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __('The settings were saved successfully', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } ?>

/>
OR email address of the user. If such a user exists, an email with a One Time Login link will be sent to the email address of the user. The link will be valid for 10 minutes only.', 'loginizer'); ?>



Default :


Default :

Variables :
$email - Users Email
$site_name - The Site Name
$site_url - The Site URL
$login_url - The Login URL


0){ $lz_error['not_in_free'] = __('This feature is not available in the Free version. Upgrade to Pro', 'loginizer'); return loginizer_page_security_T(); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } if(isset($_POST['save_lz'])){ $option['login_slug'] = lz_optpost('login_slug'); $option['rename_login_secret'] = (int) lz_optpost('rename_login_secret'); $option['xmlrpc_slug'] = lz_optpost('xmlrpc_slug'); $option['xmlrpc_disable'] = (int) lz_optpost('xmlrpc_disable'); $option['pingbacks_disable'] = (int) lz_optpost('pingbacks_disable'); // Login Slug Valid ? if(!empty($option['login_slug'])){ if(strlen($option['login_slug']) <= 4 || strlen($option['login_slug']) > 50){ $lz_error['login_slug'] = __('The Login slug length must be greater than 4 chars and upto 50 chars long', 'loginizer'); } } // XML-RPC Slug Valid ? if(!empty($option['xmlrpc_slug'])){ if(strlen($option['xmlrpc_slug']) <= 4 || strlen($option['xmlrpc_slug']) > 50){ $lz_error['xmlrpc_slug'] = __('The XML-RPC slug length must be greater than 4 chars and upto 50 chars long', 'loginizer'); } } // Is there an error ? if(!empty($lz_error)){ return loginizer_page_security_T(); } // Save the options update_option('loginizer_security', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Reset the username if(isset($_POST['save_lz_admin'])){ // Get the new username $current_username = lz_optpost('current_username'); $new_username = lz_optpost('new_username'); if(empty($current_username)){ $lz_error['current_username_empty'] = __('Current username is required', 'loginizer'); return loginizer_page_security_T(); } if(empty($new_username)){ $lz_error['new_username_empty'] = __('New username is required', 'loginizer'); return loginizer_page_security_T(); } // Is the starting of the username having 'admin' ? if(@strtolower(substr($new_username, 0, 5)) == 'admin'){ $lz_error['user_exists'] = __('The username begins with admin. Please change it !', 'loginizer'); return loginizer_page_security_T(); } // Lets check if there is such a user $found = get_user_by('login', $new_username); // Found one ! if(!empty($found->ID)){ $lz_error['user_exists'] = __('The new username is already assigned to another user', 'loginizer'); return loginizer_page_security_T(); } $old_user = get_user_by('login', $current_username); if(empty($old_user->ID)){ $lz_error['current_username_invalid'] = __('No user found with the current username provided', 'loginizer'); return loginizer_page_security_T(); } if(empty($old_user->caps['administrator'])){ $lz_error['user_not_admin'] = __('The user is not an administrator. Only administrator user\'s username can be changed.', 'loginizer'); return loginizer_page_security_T(); } // Update the username $wpdb->query("UPDATE `".$wpdb->prefix."users` SET user_login = '$new_username' WHERE `ID` = '".$old_user->ID."'"); // Mark as saved $GLOBALS['lz_saved'] = true; } // Change the wp-admin slug if(isset($_POST['save_lz_wp_admin'])){ // Get the new username $option['admin_slug'] = lz_optpost('admin_slug'); $option['restrict_wp_admin'] = (int) lz_optpost('restrict_wp_admin'); $option['wp_admin_msg'] = @stripslashes($_POST['wp_admin_msg']); $lz_wp_admin_docs = (int) lz_optpost('lz_wp_admin_docs'); // Did you agree to this ? if(!empty($option['admin_slug']) && empty($lz_wp_admin_docs)){ $lz_error['lz_wp_admin_docs'] = __('You have not confirmed that you have read the guide and configured .htaccess. Please read the guide, configure .htaccess and then save these settings and check this checkbox', 'loginizer'); return loginizer_page_security_T(); } // Length if(!empty($option['admin_slug']) && (strlen($option['admin_slug']) <= 4 || strlen($option['admin_slug']) > 50)){ $lz_error['admin_slug'] = __('The new Admin slug length must be greater than 4 chars and upto 50 chars long', 'loginizer'); return loginizer_page_security_T(); } // Only regular characters if(preg_match('/[^\w\d\-_]/is', $option['admin_slug'])){ $lz_error['admin_slug_chars'] = __('Special characters are not allowed', 'loginizer'); return loginizer_page_security_T(); } // Update the option update_option('loginizer_wp_admin', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Save blacklisted usernames if(isset($_POST['save_lz_bl_users'])){ $usernames = isset($_POST['lz_bl_users']) && is_array($_POST['lz_bl_users']) ? $_POST['lz_bl_users'] : array(); // Process the usernames i.e. remove blanks foreach($usernames as $k => $v){ $v = trim($v); // Unset blank values if(empty($v)){ unset($usernames[$k]); } // Disallow these special characters to avoid XSS or any other security vulnerability if(preg_match('/[\<\>\"\']/', $v)){ unset($usernames[$k]); } } // Update the blacklist update_option('loginizer_username_blacklist', array_values($usernames)); // Mark as saved $GLOBALS['lz_saved'] = true; } // Save blacklisted domains if(isset($_POST['save_lz_bl_domains'])){ $domains = isset($_POST['lz_bl_domains']) && is_array($_POST['lz_bl_domains']) ? $_POST['lz_bl_domains'] : array(); // Process the domains i.e. remove blanks foreach($domains as $k => $v){ $v = trim($v); // Unset blank values if(empty($v)){ unset($domains[$k]); } // Disallow these special characters to avoid XSS or any other security vulnerability if(preg_match('/[\<\>\"\']/', $v)){ unset($domains[$k]); } } // Update the blacklist update_option('loginizer_domains_blacklist', array_values($domains)); // Mark as saved $GLOBALS['lz_saved'] = true; } // Call theme loginizer_page_security_T(); } // Loginizer - Security Settings Page Theme function loginizer_page_security_T(){ global $loginizer, $lz_error, $lz_env; // Universal header loginizer_page_header('Security Settings'); loginizer_feature_available('Security Settings'); // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __('The settings were saved successfully', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } $current_admin = get_user_by('id', 1); ?>

You can rename your Login page from to anything of your choice e.g. mylogin. This would make it very difficult for automated attack bots to know where to login !


/>


disable the XML-RPC feature as it prevents attackers from using the feature to attack the site. If your service can use a custom XML-RPC URL, you can also rename the XML-RPC page to a custom slug.', 'loginizer'); ?>
/>
/>



'; } ?>
'.__('Rename wp-admin access feature is supported only on Apache and Litespeed', 'loginizer').'
You can rename your WordPress Admin access URL wp-admin to anything of your choice e.g. my-admin. This will require you to change .htaccess, so please follow our guide on how to do so !


', 'loginizer'); ?>
/>

our guide so that we can safely enable this feature', 'loginizer'); ?>





admin, administrator, or variations of your domain name / business name. You can specify such username here and Loginizer will auto-blacklist the IP Address(s) of clients who try to use such username(s).', 'loginizer'); ?>

* (Star)- as a wild card as well. Blank fields will be ignored', 'loginizer'); ?>
'; } ?>


If you would like to ban new registrations from a particular domain, you can use this utility to do so.

* (Star)- as a wild card as well. Blank fields will be ignored', 'loginizer'); ?>
'; } ?>


$iv){ $ignores[$iv] = array(); if(!empty($files[$iv])){ $ignores[$iv] = $files[$iv]; } } $lz_env['files'] = $files; $lz_env['ignores'] = $ignores; } // Loginizer - PasswordLess Page function loginizer_page_checksums(){ global $loginizer, $lz_error, $lz_env; if(!current_user_can('manage_options')){ wp_die('Sorry, but you do not have permissions to change settings.'); } if(!loginizer_is_premium() && count($_POST) > 0){ $lz_error['not_in_free'] = __('This feature is not available in the Free version. Upgrade to Pro', 'loginizer'); return loginizer_page_checksums_T(); } /* Make sure post was from this page */ if(count($_POST) > 0){ check_admin_referer('loginizer-options'); } // Are we to run it ? if(isset($_REQUEST['lz_run_checksum'])){ loginizer_checksums(); } loginizer_page_checksums_L($files, $_ignores); $lz_env['csum_freq'][1] = __('Once a Day', 'loginizer'); $lz_env['csum_freq'][7] = __('Once a Week', 'loginizer'); $lz_env['csum_freq'][30] = __('Once a Month', 'loginizer'); if(isset($_POST['save_lz'])){ // In the future there can be more settings $option['disable_checksum'] = (int) lz_optpost('disable_checksum'); $option['no_checksum_email'] = (int) lz_optpost('no_checksum_email'); $option['checksum_frequency'] = (int) lz_optpost('checksum_frequency'); $option['checksum_time'] = lz_optpost('checksum_time'); // Is there an error ? if(!empty($lz_error)){ return loginizer_page_checksums_T(); } // Save the options update_option('loginizer_checksums', $option); // Mark as saved $GLOBALS['lz_saved'] = true; } // Add or remove from ignore list if(isset($_POST['save_lz_csum_ig'])){ if(@is_array($_POST['checksum_del_ignore'])){ foreach($_POST['checksum_del_ignore'] as $k => $v){ $key = array_search($v, $_ignores); if($key !== false){ unset($_ignores[$key]); } } // Save it update_option('loginizer_checksums_ignore', $_ignores); } if(@is_array($_POST['checksum_add_ignore'])){ foreach($_POST['checksum_add_ignore'] as $k => $v){ if(!empty($files[$v])){ $_ignores[] = $v; } } // Save it update_option('loginizer_checksums_ignore', $_ignores); } // Reload loginizer_page_checksums_L($files, $_ignores); // Mark as saved $GLOBALS['lz_saved'] = true; } // Call theme loginizer_page_checksums_T(); } // Loginizer - PasswordLess Page Theme function loginizer_page_checksums_T(){ global $loginizer, $lz_error, $lz_env; // Universal header loginizer_page_header('File Checksum Settings'); loginizer_feature_available('File Checksum'); wp_enqueue_script('jquery-clockpicker', LOGINIZER_URL.'/jquery-clockpicker.min.js', array('jquery'), '0.0.7'); wp_enqueue_style('jquery-clockpicker', LOGINIZER_URL.'/jquery-clockpicker.min.css', array(), '0.0.7'); // Saved ? if(!empty($GLOBALS['lz_saved'])){ echo '

'. __('The settings were saved successfully', 'loginizer'). '


'; } // Did we just run the checksums if(isset($_REQUEST['lz_run_checksum'])){ echo '

'. __('The Checksum process was executed successfully', 'loginizer'). '


'; } // Any errors ? if(!empty($lz_error)){ lz_report_error($lz_error);echo '
'; } ?>


/>

/>



$v){ if(!empty($lz_env['ignores'][$k])){ unset($files[$k]); } } } echo ' '; if(is_array($files) && count($files) > 0){ foreach($files as $k => $v){ echo ' '; } }else{ echo ' '; } ?>
'.__('Relative Path', 'loginizer').' '.__('Found', 'loginizer').' '.__('Should be', 'loginizer').'
'.$k.' '.$v['cur_md5'].' '.$v['md5'].'
'.__('This is great ! No file with any wrong checksum has been found.').'


'; // Load any mismatched files $files = $ignores; if(is_array($files) && count($files) > 0){ foreach($files as $k => $v){ echo ' '; } }else{ echo ' '; } ?>
'.__('Relative Path', 'loginizer').' '.__('Found', 'loginizer').' '.__('Should be', 'loginizer').'
'.$k.' '.$v['cur_md5'].' '.$v['md5'].'
'.__('No files have been added to the ignore list').'


prefix."loginizer_logs;"; foreach($sql as $sk => $sv){ $wpdb->query($sv); } delete_option('loginizer_version'); delete_option('loginizer_options'); delete_option('loginizer_last_reset'); delete_option('loginizer_whitelist'); delete_option('loginizer_blacklist'); delete_option('loginizer_msg'); delete_option('loginizer_security'); delete_option('loginizer_wp_admin'); }