<div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator', APP_TD); ?> </div> <span class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', APP_TD); ?> </span> </div> <?php } ?> <div class="captchadiv"> <p class="captcha_login" style="text-align:center"> <?php if (function_exists('cptch_check_custom_form') && cptch_check_custom_form() !== true || function_exists('cptchpr_check_custom_form') && cptchpr_check_custom_form() !== true) { echo "Please complete the CAPTCHA."; } ?> </p> </div> <?php do_action('register_form'); ?> <div id="checksave"> <p class="submit" style="float:right;"> <input tabindex="6" class="btn_orange" type="submit" name="register" id="register" value="<?php _e('Create Account', APP_TD);
function sbscrbr_handle_form_data() { global $wpdb, $sbscrbr_options, $cptchpr_options, $lmtttmptspr_options, $sbscrbr_send_unsubscribe_mail, $sbscrbr_add_content_message; $cptchpr_error_incorrect_value = !empty($cptchpr_options['cptchpr_error_incorrect_value']) ? $cptchpr_options['cptchpr_error_incorrect_value'] : __("Please complete the CAPTCHA.", 'subscriber'); if (empty($lmtttmptspr_options)) { $lmtttmptspr_options = get_option('lmtttmptspr_options'); } $all_plugins = get_plugins(); if (empty($sbscrbr_options)) { $sbscrbr_options = is_multisite() ? get_site_option('sbscrbr_options') : get_option('sbscrbr_options'); } $request_error_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['bad_request'] . '</p>'; $empty_mail_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['empty_email'] . '</p>'; $invalid_mail_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['invalid_email'] . '</p>'; $error_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['error_subscribe'] . '</p>'; $unsubscribe_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['already_unsubscribe'] . '</p>'; $done_message = '<p class="sbscrbr-form-done">' . $sbscrbr_options['done_subscribe'] . '</p>'; $prefix = is_multisite() ? $wpdb->base_prefix : $wpdb->prefix; if (empty($sbscrbr_add_content_message)) { if (isset($_POST['sbscrbr_submit_email'])) { /* if request was sended from subscribe form */ if (isset($cptchpr_options['cptchpr_subscriber']) && 1 == $cptchpr_options['cptchpr_subscriber']) { if (function_exists('cptchpr_check_custom_form') && cptchpr_check_custom_form() !== true) { if (array_key_exists('limit-attempts-pro/limit-attempts-pro.php', $all_plugins) && is_plugin_active('limit-attempts-pro/limit-attempts-pro.php') && isset($lmtttmptspr_options['subscriber_captcha_check'])) { $lmtttmpts_prefix = $wpdb->prefix . 'lmtttmpts_'; $ip = lmtttmptspr_get_address(); $attempts = $wpdb->get_var("SELECT `failed_attempts` \n\t\t\t\t\t\t\t\tFROM `" . $lmtttmpts_prefix . "failed_attempts` \n\t\t\t\t\t\t\t\tWHERE `ip_int` = '" . sprintf('%u', ip2long($ip)) . "'"); $blocks = $wpdb->get_var("SELECT `block_quantity` \n\t\t\t\t\t\t\t\tFROM `" . $lmtttmpts_prefix . "failed_attempts` \n\t\t\t\t\t\t\t\tWHERE `ip_int` = '" . sprintf('%u', ip2long($ip)) . "'"); if (!lmtttmptspr_is_ip_in_table($ip, 'whitelist')) { if (lmtttmptspr_is_ip_in_table($ip, 'blacklist')) { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . str_replace('%MAIL%', $lmtttmptspr_options['email_address'], $lmtttmptspr_options['blacklisted_message']) . '</p>'; } elseif (lmtttmptspr_is_ip_blocked($ip)) { $when = $wpdb->get_var("SELECT `block_till` \n\t\t\t\t\t\t\t\t\t\tFROM `" . $lmtttmpts_prefix . "failed_attempts` \n\t\t\t\t\t\t\t\t\t\tWHERE `ip_int` = '" . sprintf('%u', ip2long($ip)) . "'"); $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . str_replace(array('%DATE%', '%MAIL%'), array($when, $lmtttmptspr_options['email_address']), $lmtttmptspr_options['blocked_message']) . '</p>'; } else { $tries = $wpdb->get_var("SELECT `failed_attempts` \n\t\t\t\t\t\t\t\t\t\tFROM `" . $lmtttmpts_prefix . "failed_attempts` \n\t\t\t\t\t\t\t\t\t\tWHERE `ip_int` = '" . sprintf('%u', ip2long($ip)) . "'"); $allowed_tries = max($lmtttmptspr_options['allowed_retries'] - $tries, 0); /*calculation of allowed retries*/ $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $cptchpr_error_incorrect_value . '</br>' . str_replace('%ATTEMPTS%', $allowed_tries, $lmtttmptspr_options['failed_message']) . '</p>'; } } else { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $cptchpr_error_incorrect_value . '</p>'; } } else { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $cptchpr_error_incorrect_value . '</p>'; } return $sbscrbr_add_content_message; } } if (isset($_POST['sbscrbr_unsubscribe']) && 'yes' == $_POST['sbscrbr_unsubscribe']) { /* unsubscribe user */ if (empty($_POST['sbscrbr_email'])) { $sbscrbr_add_content_message = $empty_mail_message; } else { if (!is_email($_POST['sbscrbr_email'])) { /* invalid email */ $sbscrbr_add_content_message = $invalid_mail_message; } else { $user_exists = email_exists($_POST['sbscrbr_email']); /* check if user is registered */ if ($user_exists) { $user_status = sbscrbr_check_status($_POST['sbscrbr_email']); /* check user status */ if (!empty($user_status)) { switch ($user_status) { case 'not_exists': case 'not_subscribed': $sbscrbr_add_content_message = $unsubscribe_message; break; case 'subscribed': case 'in_trash': case 'in_black_list': if ($sbscrbr_send_unsubscribe_mail !== true) { $result = sbscrbr_sent_unsubscribe_mail($_POST['sbscrbr_email']); /* send email with unsubscribe link */ if (!empty($result)) { /* show report message */ if ($result['done']) { $sbscrbr_add_content_message = '<p class="sbscrbr-form-done">' . $sbscrbr_options['check_email_unsubscribe'] . '</p>'; } else { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $result['error'] . '</p>'; } } else { $sbscrbr_add_content_message = $request_error_message; } } break; default: $sbscrbr_add_content_message = $error_message; break; } } else { $sbscrbr_add_content_message = $error_message; } } else { /* if no user with this e-mail */ /* check user status */ if ('subscribed' == sbscrbr_check_status($_POST['sbscrbr_email'])) { if ($sbscrbr_send_unsubscribe_mail !== true) { $result = sbscrbr_sent_unsubscribe_mail($_POST['sbscrbr_email']); /* send email with unsubscribe link */ if (!empty($result)) { /* show report message */ if ($result['done']) { $sbscrbr_add_content_message = '<p class="sbscrbr-form-done">' . $sbscrbr_options['check_email_unsubscribe'] . '</p>'; } else { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $result['error'] . '</p>'; } } else { $sbscrbr_add_content_message = $request_error_message; } } } else { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['not_exists_email'] . '</p>'; } } } } } else { /* subscribe user */ if (empty($_POST['sbscrbr_email'])) { $sbscrbr_add_content_message = $empty_mail_message; } else { if (!is_email($_POST['sbscrbr_email'])) { /* invalid email */ $sbscrbr_add_content_message = $invalid_mail_message; } else { $user_exists = email_exists($_POST['sbscrbr_email']); /* check if user is registered */ if ($user_exists) { /* if user already registered */ $user_status = sbscrbr_check_status($_POST['sbscrbr_email']); /* check user status */ if (!empty($user_status)) { switch ($user_status) { case 'not_exists': /* add user data to database table of plugin */ $user = get_user_by('email', $_POST['sbscrbr_email']); $wpdb->insert($prefix . 'sndr_mail_users_info', array('id_user' => $user->ID, 'user_email' => $_POST['sbscrbr_email'], 'user_display_name' => $user->display_name, 'subscribe' => 1, 'unsubscribe_code' => md5(rand(0, 10) / 10), 'subscribe_time' => time())); if ($wpdb->last_error) { $sbscrbr_add_content_message = $error_message; } else { $sbscrbr_add_content_message = $done_message; sbscrbr_send_mails($_POST['sbscrbr_email'], ''); /* send letters to admin and new registerd user*/ } break; case 'subscribed': $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['already_subscribe'] . '</p>'; break; case 'not_subscribed': case 'in_trash': $wpdb->update($prefix . 'sndr_mail_users_info', array('subscribe' => '1', 'delete' => '0'), array('user_email' => $_POST['sbscrbr_email'])); if ($wpdb->last_error) { $sbscrbr_add_content_message = $error_message; } else { $sbscrbr_add_content_message = $done_message; sbscrbr_send_mails($_POST['sbscrbr_email'], ''); /* send letters to admin and new registerd user*/ } break; case 'in_black_list': $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['denied_subscribe'] . '</p>'; break; default: $sbscrbr_add_content_message = $error_message; break; } } else { $sbscrbr_add_content_message = $error_message; } } else { $user_password = wp_generate_password($length = 12, $include_standard_special_chars = false); /* register new user */ $userdata = array('user_login' => $_POST['sbscrbr_email'], 'nickname' => $_POST['sbscrbr_email'], 'user_pass' => $user_password, 'user_email' => $_POST['sbscrbr_email'], 'display_name' => $_POST['sbscrbr_email'], 'role' => 'sbscrbr_subscriber'); $user_id = wp_insert_user($userdata); if (is_wp_error($user_id)) { $sbscrbr_add_content_message = $error_message; } else { /* if "Sender" plugin by BWS is not installed and activated */ if (!function_exists('sndr_mail_register_user') && !function_exists('sndrpr_mail_register_user')) { $user_status = sbscrbr_check_status($_POST['sbscrbr_email']); /* check user status */ if (!empty($user_status)) { switch ($user_status) { case 'not_exists': /* add user data to database table of plugin */ $wpdb->insert($prefix . 'sndr_mail_users_info', array('id_user' => $user_id, 'user_email' => $_POST['sbscrbr_email'], 'user_display_name' => $_POST['sbscrbr_email'], 'subscribe' => 1, 'unsubscribe_code' => md5(rand(0, 10) / 10), 'subscribe_time' => time())); break; case 'subscribed': $sbscrbr_add_content_message = $done_message; break; case 'not_subscribed': case 'in_trash': $wpdb->update($prefix . 'sndr_mail_users_info', array('subscribe' => '1', 'delete' => '0'), array('user_email' => $_POST['sbscrbr_email'])); break; case 'in_black_list': $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['denied_subscribe'] . '</p>'; break; default: $sbscrbr_add_content_message = $error_message; break; } } else { $wpdb->insert($prefix . 'sndr_mail_users_info', array('id_user' => $user_id, 'user_email' => $_POST['sbscrbr_email'], 'user_display_name' => $_POST['sbscrbr_email'], 'subscribe' => 1, 'unsubscribe_code' => md5(rand(0, 10) / 10), 'subscribe_time' => time())); } } if (empty($sbscrbr_add_content_message)) { if ($wpdb->last_error) { $sbscrbr_add_content_message = $error_message; } else { $sbscrbr_add_content_message = $done_message; sbscrbr_send_mails($_POST['sbscrbr_email'], $user_password); } } } } } } } } elseif (isset($_GET['sbscrbr_unsubscribe'])) { /* if user go to the site by "unsubscribe"-link */ $user_data = $wpdb->get_row("SELECT `subscribe` FROM `" . $prefix . "sndr_mail_users_info` WHERE `id_user`='" . $_GET['id'] . "' AND `unsubscribe_code`='" . $_GET['code'] . "'", ARRAY_A); if (empty($user_data)) { $sbscrbr_add_content_message = '<p class="sbscrbr-form-error">' . $sbscrbr_options['not_exists_unsubscribe'] . '</p>'; } else { if ('0' == $user_data['subscribe']) { $sbscrbr_add_content_message = $unsubscribe_message; } else { $wpdb->update($prefix . 'sndr_mail_users_info', array('subscribe' => '0', 'unsubscribe_time' => time()), array('id_user' => $_GET['id'])); $sbscrbr_add_content_message = $wpdb->last_error ? $request_error_message : '<p class="sbscrbr-form-done">' . $sbscrbr_options['done_unsubscribe'] . '</p>'; } } } } return $sbscrbr_add_content_message; }
private function validate_captchabestwebsoft() { if (function_exists('cptch_check_custom_form') && cptch_check_custom_form() !== true || function_exists('cptchpr_check_custom_form') && cptchpr_check_custom_form() !== true) { return false; } else { return true; } }
/** * login user into website # used wp_signon # used AE_Users function convert * @param array $user data # wordpress user fields data # user custom meta data * @return user object after insert # wp_error object if user data invalid * @author Dakachi * @since 1.0 */ public function login($user_data) { global $current_user; // echo 'login'; // check users if he is member of this blog $user = get_user_by('login', $user_data['user_login']); // if login by username failed check by email if (is_wp_error($user) || !$user) { $user = get_user_by('email', $user_data['user_login']); } /** * check user infomation */ if (!$user) { return new WP_Error('login_failed', __("The login information you entered were incorrect. Please try again!", 'aecore-class-ae-users-backend')); } if (function_exists('cptch_check_custom_form') && cptch_check_custom_form() !== true || function_exists('cptchpr_check_custom_form') && cptchpr_check_custom_form() !== '') { return new WP_Error('cptch_check_custom_form', __("Please complete the CAPTCHA.", 'aecore-class-ae-users-backend')); } if (is_multisite() && !is_user_member_of_blog($user->ID)) { $roles = $user->roles; $role = array_pop($roles); add_user_to_blog(get_current_blog_id(), $user->ID, $role); } $user_login = $user->user_login; $creds = array(); $creds['user_login'] = $user_login; $creds['user_password'] = $user_data['user_pass']; $creds['remember'] = true; $result = wp_signon($creds, false); /** * get user data and return a full profile */ if ($result && !is_wp_error($result)) { // set current user to logged in wp_set_current_user($result->ID); $result = $this->convert($result); /** * action ae_login_user * @param Object $result User object * @author Dakachi */ do_action('ae_login_user', $result); } if (!isset($result->msg)) { $result->msg = __("You have signed in successfully!", 'aecore-class-ae-users-backend'); } return apply_filters('ae_after_login_user', $result); }