public static function submit_registration_ajax() { check_ajax_referer('displet_register_user_nonce'); if (isset($_POST['action']) && $_POST['action'] == 'displet_user_registration_request') { if (!empty($_POST['name']) && !empty($_POST['email']) && (empty(self::$_options['require_phone']) || !empty($_POST['phone'])) && (empty(self::$_options['require_working_with_realtor']) || empty(self::$_options['include_working_with_realtor']) || !empty($_POST['realtor']))) { if (is_email($_POST['email'])) { $is_blacklisted_email = DispletRetsIdxLeadsModel::is_blacklisted_email($_POST['email']); $is_blacklisted_name = DispletRetsIdxLeadsModel::is_blacklisted_name($_POST['name']); if (!empty($is_blacklisted_email)) { echo 'We\'re sorry, the email address provided has been prohibited.'; } else { if (!empty($is_blacklisted_name)) { echo 'We\'re sorry, the name provided has been prohibited.'; } else { $result = DispletRetsIdxLeadsController::create_new_re_search_user(array('email' => $_POST['email'], 'name' => $_POST['name'], 'phone' => $_POST['phone'], 'realtor' => $_POST['realtor'], 'url' => $_POST['url'], 'upstream_url' => $_POST['upstream_url'], 'last_hash' => $_POST['last_hash'], 'listing_agent_email' => $_POST['listing_agent_email'], 'user_address' => $_POST['user_address'], 'user_address_time' => $_POST['user_address_time'])); if (!empty($result['success'])) { echo 'Successful Registration'; } else { echo $result; } } } } else { echo 'Please enter a valid email address.'; } } else { echo 'Please complete the required fields.'; } die; } echo 'We\'re sorry, there was an error processing your request. Please try again.'; die; }