function wp_email_capture_form_page($error = 0) { $url = get_option('home'); $url = addLastCharacter($url); $display = ""; $display .= "<div id='wp_email_capture_2' class='wp-email-capture wp-email-capture-display'><form name='wp_email_capture_display' method='post' action='" . $url . "'>\n"; if (isset($_GET['wp_email_capture_error'])) { $error = wp_email_capture_sanitize($_GET['wp_email_capture_error']); $display .= "<div class='wp-email-capture-error'>Error: " . " " . $error . "</div>\n"; } $display .= "<label class='wp-email-capture-name wp-email-capture-label wp-email-capture-display-worldwide wp-email-capture-name-display wp-email-capture-name-label wp-email-capture-name-label-display"; if (get_option("wp_email_capture_name_required") == 1) { $display .= " wp-email-capture-required"; } $display .= "' for='wp-email-capture-name-display'>" . __('Name:', 'WPEC') . "</label> <input name='wp-email-capture-name' id='wp-email-capture-name-display' type='text' class='wp-email-capture-name wp-email-capture-label wp-email-capture-display-worldwide wp-email-capture-name-display wp-email-capture-name-input wp-email-capture-name-input-display' title='Name' /><br/>\n"; $display .= "<label class='wp-email-capture-email wp-email-capture-label wp-email-capture-display wp-email-capture-email-display wp-email-capture-email-label wp-email-capture-email-label-display' for='wp-email-capture-email-display'>" . __('Email:', 'WPEC') . "</label> <input name='wp-email-capture-email' id='wp-email-capture-email-display' type='text' class='wp-email-capture-email wp-email-capture-input wp-email-capture-display wp-email-capture-email-display wp-email-capture-email-input wp-email-capture-email-input-display' title='Email' /><br/>\n"; $display .= "<input type='hidden' name='wp_capture_action' value='1' />\n"; $display .= "<input name='Submit' type='submit' value='" . __('Submit', 'WPEC') . "' class='wp-email-capture-submit' /></form></div>\n"; if (get_option("wp_email_capture_link") == 1) { $display .= "<p style='font-size:10px;'>" . __('Powered by', 'WPEC') . " <a href='http://wpemailcapture.com/' target='_blank'>WP Email Capture</a></p>\n"; } return $display; }
function wp_capture_email_confirm() { global $wpdb; // Passkey that got from link $passkey = wp_email_capture_sanitize($_GET['wp_email_capture_passkey']); $table_name = $wpdb->prefix . "wp_email_capture_temp_members"; $sql1 = "SELECT id FROM {$table_name} WHERE confirm_code ='%s'"; $result = $wpdb->get_var($wpdb->prepare($sql1, $passkey)); if ($result != '') { $table_name2 = $wpdb->prefix . "wp_email_capture_registered_members"; $sql2 = "SELECT * FROM {$table_name} WHERE confirm_code ='%s'"; $rowresults = $wpdb->get_results($wpdb->prepare($sql2, $passkey)); foreach ($rowresults as $rowresult) { $name = $rowresult->name; $email = $rowresult->email; $result3 = $wpdb->insert($table_name2, array('name' => $name, 'email' => $email), array('%s', '%s')); } } else { if (strpos($url, "?") === false) { $extrastring = "?"; } else { $extrastring = "&"; } $error = urlencode(__('Wrong confirmation code', 'WPEC')); $url = $url . $extrastring . "wp_email_capture_error=" . $error; wp_redirect($url); } // if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if ($result3) { $sql4 = "DELETE FROM {$table_name} WHERE confirm_code = '%s'"; $result4 = $wpdb->query($wpdb->prepare($sql4, $passkey)); $fullreg = ""; $fullreg = get_option('wp_email_capture_redirection'); if ($fullreg == "") { $fullreg = get_bloginfo('url'); } wp_redirect($fullreg); echo "<meta http-equiv='refresh' content='0;" . $fullreg . "'>"; die; } }