Jump to content

twilitegxa

Members
  • Posts

    1,020
  • Joined

  • Last visited

Posts posted by twilitegxa

  1. Your code produced these two errors:

     

     

    Warning: move_uploaded_file(/wdbl_wordpress/wp-content/themes/twentyten_2/upload/dd.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in/home/webdes17/public_html/wdbl_wordpress/wp-content/themes/twentyten_2/submit_jewelry.php on line 45
    
    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpdaKdwL' to '/wdbl_wordpress/wp-content/themes/twentyten_2/upload/dd.jpg' in/home/webdes17/public_html/wdbl_wordpress/wp-content/themes/twentyten_2/submit_jewelry.php on line 45
    Stored in: http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/dd.jpg
    

    What am I doing wrong now? I have:

     

     

    
    <?php
    $dbhost = 'localhost';
    $dbuser = 'user';
    $dbpass = 'pass';
    
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    
    $dbname = 'database';
    mysql_select_db($dbname);
    
    
    $cut = $_POST['cut'];
    $color = $_POST['color'];
    $carats = $_POST['carats'];
    $clarity = $_POST['clarity'];
    $size = $_POST['size'];
    $type = $_POST['type'];
    $other = $_POST['other'];
    $total = $_POST['total'];
    $certificate = $_POST['certificate'];
    $value = $_POST['value'];
    
    
    if ((($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/pjpeg"))
    && ($_FILES["file"]["size"] < 20000))
      {
      if ($_FILES["file"]["error"] > 0)
        {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
        }
      else
        {
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
    
    
         if (file_exists("/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]))
          {
          echo $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"];
         
         $image = "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"];
         
          $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$type', '$other', '$total', '$certificate', '$value', '$image')";
    $query_res = mysql_query($query) or die(mysql_error());
          }
        }
      }
    else
      {
      echo "Invalid file";
      }
          
        
    
    
    
    
    
    
    ?>
    

  2. I am trying to write this php code that is a form that allows the user to upload images along with a few other text fields. I keep getting this error when trying to upload the file to the server:

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpiPdn6u' to 'http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/dd.jpg' in /home/webdes17/public_html/wdbl_wordpress/wp-content/themes/twentyten_2/submit_jewelry.php on line 45
    

     

     

    I have the code set up to tell me where the file is supposed to be uploaded, so it appears to upload kind of, but this error message and checking the actual folder on my server proves it doesn't get uploaded to it. I have had a code like this set up before and it worked, I just cannot find my files at the moment. Here is the code:

     

    the form:

    
    <form id="jewelry" name="jewelry" method="post" action="http://webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/submit_jewelry.php" enctype="multipart/form-data">
    <table id="jewelry" name="jewelry">
    <tr>
    <td>Cut:</td>
    <td><input type="text" id="cut" name="cut" /></td>
    </tr>
    <tr>
    <td>Color:</td>
    <td><input type="text" id="color" name="color" /></td>
    </tr>
    <tr>
    <tr>
    <td>Carats:</td>
    <td><input type="text" id="carats" name="carats" /></td>
    </tr>
    <tr>
    <td>Clarity:</td>
    <td><input type="text" id="clarity" name="clarity" /></td>
    </tr>
    <tr>
    <td>Size Of Ring:</td>
    <td><input type="text" id="size" name="size" /></td>
    </tr>
    <tr>
    <td>Type Of Gold:</td>
    <td><input type="text" id="type" name="type" /></td>
    </tr>
    <tr>
    <td>Other Diamonds:</td>
    <td><input type="text" id="other" name="other" /></td>
    </tr>
    <tr>
    <td>Total Carats:</td>
    <td><input type="text" id="total" name="total" /></td>
    </tr>
    <tr>
    <td>Certificate Type:</td>
    <td><input type="text" id="certificate" name="certificate" /></td>
    </tr>
    <tr>
    <td>Appraisal Value:</td>
    <td><input type="text" id="value" name="value" /></td>
    </tr>
    <tr>
    <td>Upload Image:</td>
    <td><input type="file" id="file" name="file" /></td>
    </tr>
    <td colspan="2"><input type="submit" id="submit" name="submit" value="Submit" />
    <input type="reset" id="reset" name="reset" value="Reset" /></td>
    </tr>
    </table>
    </form>
    

     

     

    the page that inserts it:

    
    <?php
    $dbhost = 'localhost';
    $dbuser = 'user';
    $dbpass = 'password';
    
    
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');
    
    
    $dbname = 'database';
    mysql_select_db($dbname);
    
    
    $cut = $_POST['cut'];
    $color = $_POST['color'];
    $carats = $_POST['carats'];
    $clarity = $_POST['clarity'];
    $size = $_POST['size'];
    $type = $_POST['type'];
    $other = $_POST['other'];
    $total = $_POST['total'];
    $certificate = $_POST['certificate'];
    $value = $_POST['value'];
    
    
    if ((($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/pjpeg"))
    && ($_FILES["file"]["size"] < 20000))
      {
      if ($_FILES["file"]["error"] > 0)
        {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
        }
      else
        {
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
    
    
        if (file_exists("http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]))
          {
          echo $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"];
         
         $image = "http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/" . $_FILES["file"]["name"];
         
          $query = "INSERT INTO gallery VALUES ('', '$cut', '$color', '$carats', '$clarity', '$size', '$type', '$other', '$total', '$certificate', '$value', '$image')";
    $query_res = mysql_query($query) or die(mysql_error());
          }
        }
      }
    else
      {
      echo "Invalid file";
      }
          
        
    
    
    
    
    
    
    ?>
    

     

     

    Can anyone help me figure out how to get the image uploaded and saved into the upload folder on the server? Also, the filepath is not getting inserted into the table either for some reason, and not sure why. Please, can anyone help?

  3. I'm sorry, I originally posted the unmodified code. Here is what U have so far:

     

     

    
    <?php ob_start();?>
    
    
    
    
    
    
    <?php
    
    
    /*
    
    
    Plugin Name: Wordpress Newsletter subscription Opt-in for SendBlaster
    
    
    Plugin URI: http://www.sendblaster.com/wordpress-newsletter-double-optin-widget/
    
    
    Description: Create a simple form to collect subscription requests to newsletter software managed mailing lists. User input is stored in the db and sent by e-mail in a format compatible with common newsletter softwares' data structure and subscription management.
    
    
    Version: 1.1.6
    
    
    Author: Max
    
    
    Author URI: http://www.sendblaster.com/
    
    
    */
    
    
    
    
    
    
    /*
    
    
    
    
    
    
        This program is free software; you can redistribute it and/or modify
    
    
        it under the terms of the GNU General Public License as published by
    
    
        the Free Software Foundation; either version 2 of the License, or
    
    
        (at your option) any later version.
    
    
    
    
    
    
        This program is distributed in the hope that it will be useful,
    
    
        but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    
    
        GNU General Public License for more details.
    
    
    
    
    
    
        You should have received a copy of the GNU General Public License
    
    
        along with this program; if not, write to the Free Software
    
    
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    
    
    */
    
    
    
    
    
    
    $wpsb_db_version = "0.1";
    
    
    
    
    
    
    
    
    
    
    function wpsb_show_form($rtn = 0) {	
    
    
    $wpsb_flds = (get_option('wpsb_form_fields'));
    
    
    $add_link_lv = get_option("wpsb_link_love");
    
    
    $out = '<form action="http://www.batyathebabycoach.com/thankyou-signup" method="post" name="news_frm" onSubmit="return newsletter();">' . "\n";
    
    
    
    
    
    
    
    
    if (is_array($wpsb_flds)) {
    
    
    	foreach ($wpsb_flds as $wpsb_k => $wpsb_v) {
    
    
    		if (is_numeric($wpsb_k) && $wpsb_v) {
    
    
    			$out .= '<p class="wpsb_form_label"    style="padding-left:10px;font-weight:bold; padding-top:10px; padding-right:10px;text-align:left;">' . $wpsb_v;
    
    
    			$out .= '  <input type="text" name="wpsb_fld['. $wpsb_k .']" id="wpsb_fld_'. $wpsb_k .'"  maxlength="64" class="righttab_se_txtfield " /></p><br/>' ;
    
    
    		}
    
    
    	}
    
    
    }
    
    
    $out .= '<script type="text/javascript">
    
    
    //<![CDATA[	
    
    
    	function wpsb_toggle_custom_fields (state) {
    
    
    		for (i=2; i<16; i++) {
    
    
    			if (obj = document.getElementById(\'wpsb_fld_\'+i)) {
    
    
    				obj.disabled = !state;
    
    
    				obj.readOnly = !state;
    
    
    			}
    
    
    		}
    
    
    	}
    
    
    //]]>
    
    
    </script>
    
    
    ';
    
    
    /*	$out .= '<p class="wpsb_form_label"  style="color:#178C00;"><input style="visibility:hidden;color:#178C00;"
    
    
     type="radio" name="wpsb_radio_option" id="wpsb_radio_option1" onclick="wpsb_toggle_custom_fields(1)" class="wpsb_form_radio" value="wpsb_radio_in" checked="checked" /> '.$wpsb_flds['wpsb_radio_in'];
    
    
    
    
    
     $out .= '<input type="radio" name="wpsb_radio_option" id="wpsb_radio_option2" onclick="wpsb_toggle_custom_fields(0)" class="wpsb_form_radio" value="wpsb_radio_out" style="visibility:hidden;color:#178C00;" /> '.$wpsb_flds['wpsb_radio_out'];*/
    
    
    $out .= '<p class="wpsb_form_label"  style="padding-left:10px; padding-top:5px;font-weight:bold; padding-right:10px;text-align:left;">' . get_option('wpsb_form_email');
    
    
    $out .= '<input type="text" name="wpsb_email" id="wpsb_email" class="righttab_se_txtfield "  /></p>'.'<br>'.
    '<p>.<input type="image" name="submit" value="' . get_option('wpsb_form_send').'" class="wpsb_form_btn" src="'. get_option('home').'/go.jpg" style="vertical-align:top; padding-left:90px;border:0px"
    
    
     /></p><br>' . "</form>" ;
    
    
    /*$out .= '<input type="submit" value="' . get_option('wpsb_form_send');
    
    
    $out .= '" class="wpsb_form_btn" />' . "</form>";*/
    
    
    if ($add_link_lv) {
    
    
    	$out .= "";
    
    
    }
    
    
    if ($rtn) {
    
    
    	return $out;
    
    
    }
    
    
    else {
    
    
    	echo $out;
    
    
    }
    
    
    }
    
    
    
    
    
    
    function wpsb_getip() {
    
    
    if (isset($_SERVER)) {
    
    
    	if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    
    
    		$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
    
    
    	} 
    
    
    	elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
    
    
    		$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
    
    
    	} 
    
    
    	else {
    
    
    		$ip_addr = $_SERVER["REMOTE_ADDR"];
    
    
    	}
    
    
    } 
    
    
    else {
    
    
    	if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
    
    
    		$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );
    
    
    	} 
    
    
    	elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
    
    
    		$ip_addr = getenv( 'HTTP_CLIENT_IP' );
    
    
    	} 
    
    
    	else {
    
    
    		$ip_addr = getenv( 'REMOTE_ADDR' );
    
    
    	}
    
    
    }
    
    
    return $ip_addr;
    
    
    }
    
    
    
    
    
    
    function wpsb_has_email_headers($text) {
    
    
       return preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i", $text);
    
    
    }
    
    
    
    
    
    
    function wpsb_opt_in() {
    
    
    global $wpdb;
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    
    
    
    
    echo stripslashes(get_option('wpsb_form_header'));
    
    
    
    
    
    
    $_POST['wpsb_email'] = trim($_POST['wpsb_email']);
    
    
    if (empty($_POST['wpsb_email'])) {
    
    
    	if (!empty($_GET['wpsb_d']) && !empty($_GET['wpsb_s'])) {
    
    
    		wpsb_dbl_optin_confirm();
    
    
    	}
    
    
    	else {
    
    
    		wpsb_show_form();
    
    
    	}
    
    
    } 
    
    
    else {
    
    
    	$email = stripslashes($_POST['wpsb_email']);
    
    
    	$wpsb_custom_flds = "";
    
    
    	if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
    
    
    			echo stripslashes(get_option('wpsb_msg_bad'));
    
    
    			wpsb_show_form();
    
    
    	}
    
    
    	else {
    
    
    		if ($_POST['wpsb_radio_option'] && $_POST['wpsb_radio_option'] == "wpsb_radio_out") {
    
    
    			$manager_email = stripslashes(get_option('wpsb_email_from'));
    
    
    			$wpsb_flds = (get_option('wpsb_form_fields'));
    
    
    			$headers = "MIME-Version: 1.0\n";
    
    
    			$headers .= "From: $email\n";
    
    
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    
    			if (mail($manager_email, "Unsubscribe", "", $headers)) {
    
    
    				echo stripslashes($wpsb_flds['wpsb_unsubscr_success']);
    
    
    			} 
    
    
    			else {
    
    
    				echo stripslashes(get_option('wpsb_msg_fail'));
    
    
    			}
    
    
    		}
    
    
    		else {
    
    
    			$wpsb_double_optin = get_option('wpsb_double_optin');
    
    
    			$wpsb_auto_delete = get_option('wpsb_auto_delete');
    
    
    			if (!empty($_POST['wpsb_fld'])) {
    
    
    				foreach ($_POST['wpsb_fld'] as $wpsb_k => $wpsb_v) {
    
    
    					if (ereg("^[ ]*([^\t\r\n\\]{1,64}[^ ])[ ]*$", stripslashes($wpsb_v), $wpsb_r)) {
    
    
    						$wpsb_custom_flds .= "#".$wpsb_k."#: ".$wpsb_r[1]."\n";
    
    
    					}
    
    
    				}
    
    
    			}
    
    
    			$email_from = stripslashes(get_option('wpsb_email_from'));
    
    
    			$subject = stripslashes(get_option('wpsb_email_subject'));
    
    
    			$message = stripslashes(get_option('wpsb_email_message'));
    
    
    
    
    
    			$headers = "MIME-Version: 1.0\n";
    
    
    			$headers .= "From: $email_from\n";
    
    
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    
    
    
    
    			$wpsb_time = time();
    
    
    			$wpsb_ip = wpsb_getip();
    
    
    			if ($wpsb_double_optin == 1) {
    
    
    				$wpsb_link = Array ("scheme" => "http", "host" => $_SERVER['HTTP_HOST'], "port" => "", "user" => "", "pass" => "", "path" => "", "query" => "", "fragment" => "");
    
    
    				$wpsb_link += parse_url(get_bloginfo('wpurl'));
    
    
    				$wpsb_optin_url = $wpsb_link['scheme']."://".$wpsb_link['host'].$_SERVER['SCRIPT_NAME']."?wpsb_d=".$wpsb_time."&wpsb_s=".md5($email.$wpsb_ip)."#wpsbw";
    
    
    				$message = str_replace('#link#', $wpsb_optin_url, $message);
    
    
    			}
    
    
    			$selectqry = "SELECT * FROM " . $table_users . " WHERE `email` = '" . $email ."'";
    
    
    			if ($wpdb->query($selectqry)) {
    
    
    				echo stripslashes(get_option('wpsb_msg_dbl'));
    
    
    			}
    
    
    			else {
    
    
    				if (mail($email,$subject,$message,$headers)) {
    
    
    					if ($wpsb_double_optin || !$wpsb_auto_delete) {
    
    
    						// Write new user to database
    
    
    						$insert = "INSERT INTO " . $table_users . " 
    
    
    							(time, ip, email, msg_sent, custom_data) 
    
    
    							VALUES (
    
    
    							'" . $wpsb_time . "',
    
    
    							'" . $wpsb_ip . "',
    
    
    							'" . $email . "',
    
    
    							'" . (int) !$wpsb_double_optin ."',
    
    
    							'" . $wpsb_custom_flds . "'
    
    
    							)";
    
    
    					 	$result = $wpdb->query($insert);
    
    
    					}
    
    
    					if (!$wpsb_double_optin) {
    
    
    						$headers = "MIME-Version: 1.0\n";
    
    
    						$headers .= "From: $email\n";
    
    
    						$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    
    						mail($email_from, "Subscribe", $wpsb_custom_flds, $headers);
    
    
    					}
    
    
    					echo stripslashes(get_option('wpsb_msg_sent'));
    
    
    				} 
    
    
    				else {
    
    
    					echo stripslashes(get_option('wpsb_msg_fail'));
    
    
    				}
    
    
    			}
    
    
    		}
    
    
    	}
    
    
    }
    
    
    echo stripslashes(get_option('wpsb_form_footer'));
    
    
    }
    
    
    
    
    
    
    function wpsb_dbl_optin_confirm() {
    
    
    global $wpdb;
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    $email = stripslashes(get_option('wpsb_email_from'));
    
    
    $wpsb_auto_delete = get_option('wpsb_auto_delete');
    
    
    $sql = "SELECT * FROM `". $table_users . "` WHERE `time` = '" . $_GET['wpsb_d'] . "' AND MD5(CONCAT(`email`, `ip`)) = '" . $_GET['wpsb_s'] ."' AND `msg_sent` = '0'";
    
    
    $res = $wpdb->get_results($sql);
    
    
    if (sizeof($res)) {
    
    
    	$record = $res[0];
    
    
    	$headers = "MIME-Version: 1.0\n";
    
    
    	$headers .= "From: ". $record->email."\n";
    
    
    	$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    
    	if (mail($email, "Subscribe", $record->custom_data, $headers)) {
    
    
    		if ($wpsb_auto_delete) {
    
    
    			$update = "DELETE FROM `$table_users` WHERE `id` = ". $record->id;
    
    
    		}
    
    
    		else {
    
    
    			$update = "UPDATE `$table_users` SET `msg_sent` = '1' WHERE `id` = ". $record->id;
    
    
    		}
    
    
    		$res = $wpdb->query($update);
    
    
    		echo stripslashes(get_option('wpsb_dbl_sent'));
    
    
    	}
    
    
    	else {
    
    
    		echo stripslashes(get_option('wpsb_msg_fail'));
    
    
    	}
    
    
    }
    
    
    else {
    
    
    	echo stripslashes(get_option('wpsb_dbl_fail'));
    
    
    }
    
    
    }
    
    
    
    
    
    
    function wpsb_install() {
    
    
    global $wpdb;
    
    
    global $wpsb_db_version;
    
    
    
    
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    
    
    
    
    if($wpdb->get_var("show tables like '$table_users'") != $table_users) {
    
    
    
    
    
    
    	// Table did not exist; create new
    
    
    	$sql = "CREATE TABLE `" . $table_users . "` (
    
    
      			`id` mediumint(9) NOT NULL auto_increment,
    
    
      			`time` bigint(11) NOT NULL default '0',
    
    
      			`ip` varchar(50) NOT NULL default '',
    
    
    			`email` varchar(50) NOT NULL default '',
    
    
      			`msg_sent` enum('0','1') NOT NULL default '0',
    
    
      			`custom_data` text NOT NULL,
    
    
      			UNIQUE KEY `id` (`id`)
    
    
    	);";
    
    
    	$result = $wpdb->query($sql);
    
    
    	//require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    
    
    	//dbDelta($sql);
    
    
    
    
    
    
    	// Insert initial data in table
    
    
    	$insert = "INSERT INTO `$table_users` (`time`, `ip`, `email`, `msg_sent`) " .
    
    
    		"VALUES ('" . time() . "','" . wpsb_getip() .
    
    
    		"','" . get_option('admin_email') . "', '1')";
    
    
    	$result = $wpdb->query($insert);
    
    
    
    
    
    
    	add_option("wpsb_db_version", $wpsb_db_version);
    
    
    
    
    
    
    	// Initialise options with default values
    
    
    	$blogname = get_option('blogname');
    
    
    	add_option('wpsb_widget_title', 'Choose a title for the widget');
    
    
    	add_option('wpsb_email_from', get_option('admin_email') );
    
    
    	add_option('wpsb_email_subject', "[$blogname] Mailing list subscription");
    
    
    	add_option('wpsb_email_message', "This is an automatic response to a subscription request started at $blogname.\nThanks for subscribing.\n\n#link#");
    
    
    	add_option('wpsb_double_optin', "1");
    
    
    	add_option('wpsb_link_love', "1");
    
    
    	add_option('wpsb_auto_delete', "0");
    
    
    
    
    
    	add_option('wpsb_msg_bad', "<p>Enter valid Email Address.</p>");
    
    
    	add_option('wpsb_msg_dbl', "<p>E-mail address already subscribed.</p>");
    
    
    	add_option('wpsb_msg_fail', "<p>Failed sending to e-mail address.</p>");
    
    
    	add_option('wpsb_msg_sent', "<p>Thanks for subscribing.</p>");
    
    
    	add_option('wpsb_dbl_fail', "<p>E-mail address not found or already confirmed.</p>");
    
    
    	add_option('wpsb_dbl_sent', "<p>Subscription confirmed. Thank you.</p>");
    
    
    
    
    
    
    	add_option('wpsb_form_header', "<a name=\"wpsbw\"></a><div class=\"widget module\">You may want to put some text here");
    
    
    	add_option('wpsb_form_footer', "<>");
    
    
    	add_option('wpsb_form_email', "E-mail:");
    
    
    	//add_option('wpsb_form_fields', "");
    
    
    	add_option('wpsb_form_fields', array("wpsb_radio_in"=>"Subscribe","wpsb_radio_out"=>"Unsubscribe"));
    
    
    	add_option('wpsb_form_send', "Submit");
    
    
    }
    
    
    }
    
    
    
    
    
    
    function wpsb_options() {
    
    
    global $wpdb;
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    
    
    
    
    // Handle options from get method information
    
    
    if (isset($_GET['user_id'])) {
    
    
    	$user_id = $_GET['user_id'];
    
    
    
    
    
    
    	// Delete user from database
    
    
    	$delete = "DELETE FROM " . $table_users .
    
    
    			" WHERE id = '" . $user_id . "'";
    
    
    	$result = $wpdb->query($delete);
    
    
    
    
    
    
    	// Notify admin of delete
    
    
    	echo '<div id="message" class="updated fade"><p><strong>';
    
    
    	_e('User deleted.', 'wpsb_domain');
    
    
    	echo '</strong></p><>';
    
    
    }
    
    
    
    
    
    if (isset($_GET['purge'])) {
    
    
    	$goOn = false;
    
    
    	switch (intval($_GET['purge'])) {
    
    
    		case 1:
    
    
    			// all
    
    
    			$to_del = "1";
    
    
    			$goOn = true;
    
    
    			break;
    
    
    		case 2:
    
    
    			// older than 1 week
    
    
    			$to_del = "`time` < " . strtotime("-1 week");
    
    
    			$goOn = true;
    
    
    			break;
    
    
    		case 3:
    
    
    			// older than 2 weeks
    
    
    			$to_del = "`time` < " . strtotime("-2 weeks");
    
    
    			$goOn = true;
    
    
    			break;
    
    
    		case 4:
    
    
    			// older than 1 month
    
    
    			$to_del = "`time` < " . strtotime("-1 month");
    
    
    			$goOn = true;
    
    
    			break;
    
    
    	}
    
    
    	if ($goOn) {
    
    
    		// Delete user from database
    
    
    		$delete = "DELETE FROM `" . $table_users .
    
    
    				"` WHERE " . $to_del . " AND `msg_sent` = '0'";
    
    
    		$result = $wpdb->query($delete);
    
    
    
    
    
    		// Notify admin of delete
    
    
    		echo '<div id="message" class="updated fade"><p><strong>';
    
    
    		_e($result .' user(s) deleted.', 'wpsb_domain');
    
    
    		echo '</strong></p><>';
    
    
    	}
    
    
    }
    
    
    
    
    
    
    // Get current options from database
    
    
    $email_from = stripslashes(get_option('wpsb_email_from'));
    
    
    $email_subject = stripslashes(get_option('wpsb_email_subject'));
    
    
    $email_message = stripslashes(get_option('wpsb_email_message'));
    
    
    $double_optin = get_option('wpsb_double_optin');
    
    
    $link_love = get_option('wpsb_link_love');
    
    
    $auto_delete = get_option('wpsb_auto_delete');
    
    
    $msg_bad = stripslashes(get_option('wpsb_msg_bad'));
    
    
    $msg_dbl = stripslashes(get_option('wpsb_msg_dbl'));
    
    
    $msg_fail = stripslashes(get_option('wpsb_msg_fail'));
    
    
    $msg_sent = stripslashes(get_option('wpsb_msg_sent'));
    
    
    $dbl_fail = stripslashes(get_option('wpsb_dbl_fail'));
    
    
    $dbl_sent = stripslashes(get_option('wpsb_dbl_sent'));
    
    
    
    
    
    
    $form_header = stripslashes(get_option('wpsb_form_header'));
    
    
    $form_footer = stripslashes(get_option('wpsb_form_footer'));
    
    
    $form_email = stripslashes(get_option('wpsb_form_email'));
    
    
    $form_fields = (get_option('wpsb_form_fields'));
    
    
    $form_send = stripslashes(get_option('wpsb_form_send'));
    
    
    
    
    
    
    // Update options if user posted new information
    
    
    if( $_POST['wpsb_hidden'] == 'SAb13c' ) {
    
    
    	// Read from form
    
    
    	$email_from = stripslashes($_POST['wpsb_email_from']);
    
    
    	$email_subject = stripslashes($_POST['wpsb_email_subject']);
    
    
    	$email_message = stripslashes($_POST['wpsb_email_message']);
    
    
    	$double_optin = (int) isset($_POST['wpsb_double_optin']);
    
    
    	$link_love = (int) isset($_POST['wpsb_link_love']);
    
    
    	$auto_delete = (int) isset($_POST['wpsb_auto_delete']);
    
    
    	$msg_bad = stripslashes($_POST['wpsb_msg_bad']);
    
    
    	$msg_dbl = stripslashes($_POST['wpsb_msg_dbl']);
    
    
    	$msg_fail = stripslashes($_POST['wpsb_msg_fail']);
    
    
    	$msg_sent = stripslashes($_POST['wpsb_msg_sent']);
    
    
    	$dbl_fail = stripslashes($_POST['wpsb_dbl_fail']);
    
    
    	$dbl_sent = stripslashes($_POST['wpsb_dbl_sent']);
    
    
    
    
    
    
    	$form_header = stripslashes($_POST['wpsb_form_header']);
    
    
    	$form_footer = stripslashes($_POST['wpsb_form_footer']);
    
    
    	$form_email = stripslashes($_POST['wpsb_form_email']);
    
    
    	$form_fields = is_array($_POST['wpsb_form_fld']) ? $_POST['wpsb_form_fld'] : array();
    
    
    	$form_send = stripslashes($_POST['wpsb_form_send']);
    
    
    
    
    
    
    	// Save to database
    
    
    	update_option('wpsb_email_from', $email_from );
    
    
    	update_option('wpsb_email_subject', $email_subject);
    
    
    	update_option('wpsb_email_message', $email_message);
    
    
    	update_option('wpsb_double_optin', $double_optin);
    
    
    	update_option('wpsb_link_love', $link_love);
    
    
    	update_option('wpsb_auto_delete', $auto_delete);
    
    
    
    
    
    
    	update_option('wpsb_msg_bad', $msg_bad);
    
    
    	update_option('wpsb_msg_dbl', $msg_dbl);
    
    
    	update_option('wpsb_msg_fail', $msg_fail);
    
    
    	update_option('wpsb_msg_sent', $msg_sent);
    
    
    	update_option('wpsb_dbl_fail', $dbl_fail);
    
    
    	update_option('wpsb_dbl_sent', $dbl_sent);
    
    
    
    
    
    
    	update_option('wpsb_form_header', $form_header);
    
    
    	update_option('wpsb_form_footer', $form_footer);
    
    
    	update_option('wpsb_form_email', $form_email);
    
    
    	update_option('wpsb_form_fields', ($form_fields));
    
    
    	update_option('wpsb_form_send', $form_send);
    
    
    
    
    
    
    	// Notify admin of change
    
    
    	echo '<div id="message" class="updated fade"><p><strong>';
    
    
    	_e('Options saved.', 'wpsb_domain');
    
    
    	echo '</strong></p><>';
    
    
    }
    
    
    ?>
    
    
    <div class="wrap">
    
    
      <h2>Newsletter subscription Double Opt-in Options</h2>
    
    
    <form method="post" action="">
    
    
        <fieldset class="options"> <legend>General settings</legend> 
    
    
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Mailbox for managing subscriptions:</th>
    
    
            <td> 
    
    
              <p>
    
    
    	    <input type="hidden" name="wpsb_hidden" value="SAb13c" />
    
    
                <input type="text" name="wpsb_email_from" id="wpsb_email_from" value="<?php echo $email_from; ?>" size="40" />
    
    
              </p>
    
    
              <p><em>Note for <a href="http://www.sendblaster.com" title="Free newsletter software">SendBlaster</a> 
    
    
                users</em>: this is the main parameter you have to insert inside <a href="http://www.sendblaster.com/bulk-email-software/wp-content/manage-subscriptions.gif">SendBlaster 
    
    
                Manage Subscription</a> section</p>
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Message to subscriber, subject:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_email_subject" id="wpsb_email_subject" value="<?php echo $email_subject; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Message to subscriber, content:</th>
    
    
            <td> 
    
    
              <p> 
    
    
                <textarea name="wpsb_email_message" id="wpsb_email_message" rows="4" cols="40"><?php echo $email_message; ?></textarea>
    
    
              </p>
    
    
              <p> Use the #link# placeholder where you want the URL for confirming 
    
    
                subscription to appear (only if double opt-in is checked). </p>
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Double Opt-in:</th>
    
    
            <td> 
    
    
              <input type="checkbox" name="wpsb_double_optin" id="wpsb_double_optin" value="1"<?php echo $double_optin ? " checked=\"checked\"" : "";?> />
    
    
              If checked you will receive subscribing emails only when user clicks 
    
    
              on the appropriate link inside confirmation message.</td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Link Love:</th>
    
    
            <td> 
    
    
              <input type="checkbox" name="wpsb_link_love" id="wpsb_link_love" value="1"<?php echo $link_love ? " checked=\"checked\"" : "";?> />
    
    
              If unchecked removes Plugin credits from sidebar.</td>
    
    
          </tr>
    
    
          <tr valign="top">
    
    
            <th scope="row">Delete subscribed users:</th>
    
    
            <td>
    
    
              <input type="checkbox" name="wpsb_auto_delete" id="wpsb_auto_delete" value="1"<?php echo $auto_delete ? " checked=\"checked\"" : "";?> />
    
    
              If checked automatically removes users upon their subscription (use 
    
    
              only if you download your subscriptions daily)</td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <td colspan="2"> </td>
    
    
          </tr>
    
    
        </table>
    
    
        </fieldset> <fieldset class="options"> <legend>Front side messages</legend> 
    
    
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Bad e-mail address:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_msg_bad" id="wpsb_msg_bad" value="<?php echo $msg_bad; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top">
    
    
            <th scope="row">Duplicate e-mail address:</th>
    
    
            <td>
    
    
              <input type="text" name="wpsb_msg_dbl" id="wpsb_msg_dbl" value="<?php echo $msg_dbl; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Failed to send:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_msg_fail" id="wpsb_msg_fail" value="<?php echo $msg_fail; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Success:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_msg_sent" id="wpsb_msg_sent" value="<?php echo $msg_sent; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Unsubscribe success:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[wpsb_unsubscr_success]" id="wpsb_unsubscr_success" value="<?php echo $form_fields['wpsb_unsubscr_success']; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Double opt-in failure:</th>
    
    
            <td>
    
    
              <input type="text" name="wpsb_dbl_fail" id="wpsb_dbl_fail" value="<?php echo $dbl_fail; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Double opt-in success:</th>
    
    
            <td>
    
    
              <input type="text" name="wpsb_dbl_sent" id="wpsb_dbl_sent" value="<?php echo $dbl_sent; ?>" size="40" />
    
    
            </td>
    
    
          </tr>
    
    
        </table>
    
    
        </fieldset> <fieldset class="options"> 
    
    
        <legend>Front side form appearance and labels</legend>
    
    
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Form header:</th>
    
    
            <td> 
    
    
              <textarea name="wpsb_form_header" id="wpsb_form_header" rows="4" cols="40"><?php echo $form_header; ?></textarea>
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Form footer:</th>
    
    
            <td> 
    
    
              <textarea name="wpsb_form_footer" id="wpsb_form_footer" rows="2" cols="40"><?php echo $form_footer; ?></textarea>
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">E-mail (mandatory: field #1)</th>
    
    
            <td> <p> 
    
    
                <input type="text" name="wpsb_form_email" id="wpsb_form_email" value="<?php echo $form_email; ?>" size="40" maxlength="64" /></p><p>First field (E-mail) is mandatory and cannot be removed <br />
    
    
                Leave blank to <strong>disable</strong> other custom fields, <br />
    
    
                Writing label names will <strong>enable</strong> the custom fields.</p></td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Custom field #2:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[2]" id="wpsb_form_fld2" value="<?php echo $form_fields[2]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #3:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[3]" id="wpsb_form_fld3" value="<?php echo $form_fields[3]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #4:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[4]" id="wpsb_form_fld4" value="<?php echo $form_fields[4]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #5:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[5]" id="wpsb_form_fld5" value="<?php echo $form_fields[5]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #6:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[6]" id="wpsb_form_fld6" value="<?php echo $form_fields[6]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #7:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[7]" id="wpsb_form_fld7" value="<?php echo $form_fields[7]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #8:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[8]" id="wpsb_form_fld8" value="<?php echo $form_fields[8]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #9:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[9]" id="wpsb_form_fld9" value="<?php echo $form_fields[9]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #10:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[10]" id="wpsb_form_fld10" value="<?php echo $form_fields[10]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #11:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[11]" id="wpsb_form_fld11" value="<?php echo $form_fields[11]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #12:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[12]" id="wpsb_form_fld12" value="<?php echo $form_fields[12]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #13:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[13]" id="wpsb_form_fld13" value="<?php echo $form_fields[13]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #14:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[14]" id="wpsb_form_fld14" value="<?php echo $form_fields[14]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Custom field #15:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[15]" id="wpsb_form_fld15" value="<?php echo $form_fields[15]; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Subscribe label:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[wpsb_radio_in]" id="wpsb_form_fld16" value="<?php echo $form_fields['wpsb_radio_in']; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
      <tr valign="top"> 
    
    
            <th scope="row">Unsubscribe label:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_fld[wpsb_radio_out]" id="wpsb_form_fld17" value="<?php echo $form_fields['wpsb_radio_out']; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <th scope="row">Submit button:</th>
    
    
            <td> 
    
    
              <input type="text" name="wpsb_form_send" id="wpsb_form_send" value="<?php echo $form_send; ?>" size="40" maxlength="64" />
    
    
            </td>
    
    
          </tr>
    
    
          <tr valign="top"> 
    
    
            <td colspan="2" scope="row"> </td>
    
    
          </tr>
    
    
        </table>
    
    
    </fieldset>
    
    
    <p class="submit">
    
    
    <input type="submit" name="Submit" value="Update Options »" />
    
    
    </p>
    
    
    </form>
    
    
    <>
    
    
    <div class="wrap">
    
    
    <h2>Temp Opted-in users backup</h2>
    
    
      <p>Delete users from this panel once you have downloaded subscriptions with 
    
    
        your mailing list software. <br />
    
    
    </p>
    
    
    <?php
    
    
    if ($users = $wpdb->get_results("SELECT * FROM $table_users WHERE `msg_sent` = '1' ORDER BY `id` DESC")) {
    
    
    ?>
    
    
    <h3>Bcc friendly format:</h3>
    
    
    <p>
    
    
    <?php
    
    
    	$additional_user=0;
    
    
    	foreach ($users as $user) {
    
    
    		if ($user->msg_sent == "1") {
    
    
    			if ($additional_user) {
    
    
    				echo ', ';
    
    
    			}
    
    
    			$additional_user=1;
    
    
    			echo $user->email;
    
    
    		}
    
    
    	}	
    
    
    ?>
    
    
    </p>
    
    
    <?php
    
    
    }
    
    
    if ($users = $wpdb->get_results("SELECT * FROM $table_users ORDER BY `id` DESC")) {
    
    
    	$user_no=0;
    
    
    	//$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . basename(dirname(__FILE__)). '/' . basename(__FILE__);
    
    
    	$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . $_GET['page'];
    
    
    ?>
    
    
    <table class="widefat">
    
    
    <thead>    
    
    
    <tr align="right"> 
    
    
          <td colspan="6">
    
    
        <script type="text/javascript"> 
    
    
    		//<![CDATA[
    
    
    		function confirm_purge (frm) {
    
    
    			if(frm.purge.selectedIndex != 0 && confirm('Are you sure you want to proceed?')) {
    
    
    				top.location.href='<?php echo $url; ?>&purge=' + frm.purge.options[frm.purge.selectedIndex].value;
    
    
    			}
    
    
    		}
    
    
    		//]]>
    
    
    	</script>
    
    
            <form method="get" action="">
    
    
    	  <fieldset class="options">Purge non opted-in users: 
    
    
              <select name="purge" id="purge">
    
    
                <option value="0">Select...</option>
    
    
                <option value="1">All</option>
    
    
                <option value="2">Older than 1 week</option>
    
    
                <option value="3">Older than 2 weeks</option>
    
    
                <option value="4">Older than 1 month</option>
    
    
              </select>
    
    
              <input type="button" name="prg_btn" id="prg_btn" value="Go" onclick="confirm_purge(this.form)" />
    
    
    	  </fieldset>
    
    
    	</form>
    
    
      </td>
    
    
    </tr>
    
    
    <tr>
    
    
    <th scope="col">ID</th>
    
    
    <th scope="col">Date/Time</th>
    
    
    <th scope="col">Opted-in</th>
    
    
    <th scope="col">IP</th>
    
    
    <th scope="col">E-mail</th>
    
    
    <th scope="col">Action</th>
    
    
    </tr>
    
    
    </thead>
    
    
    <tbody>
    
    
    <?php
    
    
    	$url = $url . '&user_id=';
    
    
    	foreach ($users as $user) {
    
    
    		if ($user_no&1) {
    
    
    			echo "<tr class=\"alternate\">";
    
    
    		} else {
    
    
    			echo "<tr>";
    
    
    		}
    
    
    		$user_no=$user_no+1;
    
    
    		echo "<td>$user->id</td>";
    
    
    		echo "<td>" . date(get_option('date_format'), $user->time). " " . date(get_option('time_format'), $user->time) . "</td>";
    
    
    		echo "<td>";
    
    
    		echo $user->msg_sent ? "Yes" : "No";
    
    
    		echo "</td>";
    
    
    		echo "<td>$user->ip</td>";
    
    
    		echo "<td>$user->email</td>";
    
    
    		echo "<td><a href=\"$url$user->id\" onclick=\"if(confirm('Are you sure you want to delete user with ID $user->id?')) return; else return false;\">Delete</a></td>";
    
    
    		echo "</tr>";
    
    
    	}
    
    
    ?>
    
    
    </tbody>
    
    
    </table>
    
    
    <p><em>ToolTip</em>: to insert the module in a page: 1) install the <a href="http://wordpress.org/extend/plugins/exec-php/">exec php</a> plugin; 2) insert this code in your pages: <?php wpsb_opt_in(); ?></p><>
    
    
    <?php
    
    
    }
    
    
    }
    
    
    
    
    
    
    function wpsb_widget_init() {
    
    
    global $wp_version;
    
    
    
    
    
    
    if (!function_exists('register_sidebar_widget')) {
    
    
    	return;
    
    
    }
    
    
    
    
    
    
    function wpsb_widget($args) {
    
    
    	extract($args);
    
    
    	echo $before_widget . $before_title;
    
    
    	echo get_option('wpsb_widget_title');
    
    
    	echo $after_title;
    
    
    	wpsb_opt_in();
    
    
    	echo $after_widget;
    
    
    }
    
    
    
    
    
    
    function wpsb_widget_control() {
    
    
    	$title = get_option('wpsb_widget_title');
    
    
    	if ($_POST['wpsb_submit']) {
    
    
    		$title = stripslashes($_POST['wpsb_widget_title']);
    
    
    		update_option('wpsb_widget_title', $title );
    
    
    	}
    
    
    	echo '<p>Title:<input  style="width: 200px;" type="text" value="';
    
    
    	echo $title . '" name="wpsb_widget_title" id="wpsb_widget_title" /></p>';
    
    
    	echo '<input type="hidden" id="wpsb_submit" name="wpsb_submit" value="1" />';
    
    
    }
    
    
    
    
    
    
    $width = 300;
    
    
    $height = 100;
    
    
    if ( '2.2' == $wp_version || (!function_exists( 'wp_register_sidebar_widget' ))) {
    
    
    	register_sidebar_widget('WP SendBlaster Opt-in', 'wpsb_widget');
    
    
    	register_widget_control('WP SendBlaster Opt-in', 'wpsb_widget_control', $width, $height);
    
    
    } else {
    
    
    	// v2.2.1+
    
    
    	$size = array('width' => $width, 'height' => $height);
    
    
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    
    
    	wp_register_sidebar_widget('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget', $class);
    
    
    	wp_register_widget_control('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget_control', $size);
    
    
    }
    
    
    if (function_exists('register_sidebar_module')) {
    
    
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    
    
    	register_sidebar_module('WP SendBlaster Opt-in', 'wpsb_widget', '', $class);
    
    
    	register_sidebar_module_control('WP SendBlaster Opt-in', 'wpsb_widget_control');
    
    
    
    
    
    
    }
    
    
    }
    
    
    
    
    
    
    function wpsb_add_to_menu() {
    
    
    add_options_page('WP SendBlaster Opt-in Options', 'WP SendBlaster Opt-in', 7, __FILE__, 'wpsb_options' );
    
    
    }
    
    
    
    
    
    
    function wpsb_insert ($cnt) {
    
    
     global $wpsb_ob;
    
    
     $cnt = str_replace("<!--wpsb-opt-in-->", $wpsb_ob, $cnt);
    
    
     return $cnt;
    
    
    }
    
    
    
    
    
    
    
    
    
    
    register_activation_hook(__FILE__, 'wpsb_install');
    
    
    add_action('admin_menu', 'wpsb_add_to_menu');
    
    
    add_action('init', 'wpsb_widget_init');
    
    
    
    
    
    
    ?>
    

     

     

    So far, I have it the message removed from the sidebar and have the page redirecting the the appropriate page after they sign up for the mailing list. The only thing I need to do next is make it redirect properly when they confirm their e-mail address. Currently, it opens up a new page, then after that page loads, it appears to redirect to another page which then displays the conformation success message. How can I alter what page is displayed in this situation? I have the success message the way i want it. Here is a link to the actual page:

     

     

    http://www.batyathebabycoach.com

     

     

    You can test sign ups if you need to so you can see what the plugin currently does.

  4. I have this double opt-in plugin from Wordpress that I would like to make some changes to, but I am having some trouble figuring out what bit of code I need to change and how. What it does now is when you type in your name and e-mail address, it displays a message in the same section where the two textboxes were and moves the screen down to where this text is (kind of link an anchor tag maybe?). I would like to send the user to a new page displaying a message instead of the current setup. I found a way to use a meta tag to refresh and redirect to a new page, however it is still moving the page down to where the other message would appear, even if I remove the message. Can anyone tell me which code to remove or change and how to change it so that the page stops moving down to this spot on the page? It also does this when the user clicks the confirmation e-mail, so I would like some help finding both of these sections of code please. Here is the code:

     

     

    
    <?php
    /*
    Plugin Name: Wordpress Newsletter subscription Opt-in for SendBlaster
    Plugin URI: http://www.sendblaster.com/wordpress-newsletter-double-optin-widget/
    Description: Create a simple form to collect subscription requests to newsletter software managed mailing lists. User input is stored in the db and sent by e-mail in a format compatible with common newsletter softwares' data structure and subscription management.
    Version: 1.1.6
    Author: Max
    Author URI: http://www.sendblaster.com/
    */
    
    
    /*
    
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.
    
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    */
    
    
    $wpsb_db_version = "0.1";
    
    
    
    
    function wpsb_show_form($rtn = 0) {	
    $wpsb_flds = (get_option('wpsb_form_fields'));
    $add_link_lv = get_option("wpsb_link_love");
    $out = '<form action="#wpsbw" method="post">' . "\n";
    $out .= '<p class="wpsb_form_label">' . get_option('wpsb_form_email');
    $out .= '<br /> <input type="text" name="wpsb_email" id="wpsb_email" class="wpsb_form_txt" /></p>' . "\n";
    if (is_array($wpsb_flds)) {
    	foreach ($wpsb_flds as $wpsb_k => $wpsb_v) {
    		if (is_numeric($wpsb_k) && $wpsb_v) {
    			$out .= '<p class="wpsb_form_label">' . $wpsb_v;
    			$out .= ' <input type="text" name="wpsb_fld['. $wpsb_k .']" id="wpsb_fld_'. $wpsb_k .'"  maxlength="64" class="wpsb_form_txt" /></p>' . "\n";
    		}
    	}
    }
    $out .= '<script type="text/javascript">
    //<![CDATA[	
    	function wpsb_toggle_custom_fields (state) {
    		for (i=2; i<16; i++) {
    			if (obj = document.getElementById(\'wpsb_fld_\'+i)) {
    				obj.disabled = !state;
    				obj.readOnly = !state;
    			}
    		}
    	}
    //]]>
    </script>
    ';
    $out .= '<p class="wpsb_form_label"><input type="radio" name="wpsb_radio_option" id="wpsb_radio_option1" onclick="wpsb_toggle_custom_fields(1)" class="wpsb_form_radio" value="wpsb_radio_in" checked="checked" /> '.$wpsb_flds['wpsb_radio_in'];
    $out .= '<br/>';
    $out .= '<input type="radio" name="wpsb_radio_option" id="wpsb_radio_option2" onclick="wpsb_toggle_custom_fields(0)" class="wpsb_form_radio" value="wpsb_radio_out" /> '.$wpsb_flds['wpsb_radio_out'].'</p>';
    
    $out .= '<p class="wpsb_form_label"><input type="submit" value="' . get_option('wpsb_form_send');
    $out .= '" class="wpsb_form_btn" /></p>' . "\n</form>\n<!-- Made by www.SendBlaster.com Newsletter Software Opt-in -->\n";
    if ($add_link_lv) {
    	$out .= "<h6>Get this <a href=\"http://wordpress.org/extend/plugins/newsletter-subscription-double-optin/\" title=\"Wordpress newsletter plugin\">Wordpress newsletter widget</a><br /> for <a href=\"http://www.sendblaster.com/newsletter-software-no-recurring-fees/\" title=\"newsletter softwares\">newsletter software</a></h6>";
    }
    if ($rtn) {
    	return $out;
    }
    else {
    	echo $out;
    }
    }
    
    
    function wpsb_getip() {
    if (isset($_SERVER)) {
    	if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    		$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
    	} 
    	elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
    		$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
    	} 
    	else {
    		$ip_addr = $_SERVER["REMOTE_ADDR"];
    	}
    } 
    else {
    	if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
    		$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );
    	} 
    	elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
    		$ip_addr = getenv( 'HTTP_CLIENT_IP' );
    	} 
    	else {
    		$ip_addr = getenv( 'REMOTE_ADDR' );
    	}
    }
    return $ip_addr;
    }
    
    
    function wpsb_has_email_headers($text) {
       return preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i", $text);
    }
    
    
    function wpsb_opt_in() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    echo stripslashes(get_option('wpsb_form_header'));
    
    
    $_POST['wpsb_email'] = trim($_POST['wpsb_email']);
    if (empty($_POST['wpsb_email'])) {
    	if (!empty($_GET['wpsb_d']) && !empty($_GET['wpsb_s'])) {
    		wpsb_dbl_optin_confirm();
    	}
    	else {
    		wpsb_show_form();
    	}
    } 
    else {
    	$email = stripslashes($_POST['wpsb_email']);
    	$wpsb_custom_flds = "";
    	if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
    			echo stripslashes(get_option('wpsb_msg_bad'));
    			wpsb_show_form();
    	}
    	else {
    		if ($_POST['wpsb_radio_option'] && $_POST['wpsb_radio_option'] == "wpsb_radio_out") {
    			$manager_email = stripslashes(get_option('wpsb_email_from'));
    			$wpsb_flds = (get_option('wpsb_form_fields'));
    			$headers = "MIME-Version: 1.0\n";
    			$headers .= "From: $email\n";
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    			if (mail($manager_email, "Unsubscribe", "", $headers)) {
    				echo stripslashes($wpsb_flds['wpsb_unsubscr_success']);
    			} 
    			else {
    				echo stripslashes(get_option('wpsb_msg_fail'));
    			}
    		}
    		else {
    			$wpsb_double_optin = get_option('wpsb_double_optin');
    			$wpsb_auto_delete = get_option('wpsb_auto_delete');
    			if (!empty($_POST['wpsb_fld'])) {
    				foreach ($_POST['wpsb_fld'] as $wpsb_k => $wpsb_v) {
    					if (ereg("^[ ]*([^\t\r\n\\]{1,64}[^ ])[ ]*$", stripslashes($wpsb_v), $wpsb_r)) {
    						$wpsb_custom_flds .= "#".$wpsb_k."#: ".$wpsb_r[1]."\n";
    					}
    				}
    			}
    			$email_from = stripslashes(get_option('wpsb_email_from'));
    			$subject = stripslashes(get_option('wpsb_email_subject'));
    			$message = stripslashes(get_option('wpsb_email_message'));
    
    			$headers = "MIME-Version: 1.0\n";
    			$headers .= "From: $email_from\n";
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    			$wpsb_time = time();
    			$wpsb_ip = wpsb_getip();
    			if ($wpsb_double_optin == 1) {
    				$wpsb_link = Array ("scheme" => "http", "host" => $_SERVER['HTTP_HOST'], "port" => "", "user" => "", "pass" => "", "path" => "", "query" => "", "fragment" => "");
    				$wpsb_link += parse_url(get_bloginfo('wpurl'));
    				$wpsb_optin_url = $wpsb_link['scheme']."://".$wpsb_link['host'].$_SERVER['SCRIPT_NAME']."?wpsb_d=".$wpsb_time."&wpsb_s=".md5($email.$wpsb_ip)."#wpsbw";
    				$message = str_replace('#link#', $wpsb_optin_url, $message);
    			}
    			$selectqry = "SELECT * FROM " . $table_users . " WHERE `email` = '" . $email ."'";
    			if ($wpdb->query($selectqry)) {
    				echo stripslashes(get_option('wpsb_msg_dbl'));
    			}
    			else {
    				if (mail($email,$subject,$message,$headers)) {
    					if ($wpsb_double_optin || !$wpsb_auto_delete) {
    						// Write new user to database
    //BATYA WAS HERE
    
    						$insert = "INSERT INTO " . $table_users . " 
    							(time, ip, email, msg_sent, custom_data) 
    							VALUES (
    							'" . $wpsb_time . "',
    							'" . $wpsb_ip . "',
    							'" . $email . "',
    							'" . (int) !$wpsb_double_optin ."',
    							'" . $wpsb_custom_flds . "'
    							)";
    					 	$result = $wpdb->query($insert);
    					}
    					if (!$wpsb_double_optin) {
    						$headers = "MIME-Version: 1.0\n";
    						$headers .= "From: $email\n";
    						$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    						mail($email_from, "Subscribe", $wpsb_custom_flds, $headers);
    					}
    					//echo stripslashes(get_option('wpsb_msg_sent'));
    					echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://webdesignsbyliz.com/blog/?page_id=2">';
    
    					//ADD THIS TO BATYA	
    					$custom_wpsb_field = str_replace('#2#:', '', $wpsb_custom_flds);
    					$custom_wpsb_username = str_replace(' ', '', $custom_wpsb_field);
    
    //connect to server and select database
    $conn = mysql_connect("localhost", "webdes17_lizkula", "minimoon") or die(mysql_error());
    mysql_select_db("webdes17_wrdp1", $conn) or die(mysql_error());
    						$insert1 = "INSERT INTO wp_users VALUES ('', '$custom_wpsb_username', '$custom_wpsb_username', '$custom_wpsb_username', '$email', '', NOW(), '', '', '$custom_wpsb_username')";
    						$result2 = mysql_query($insert1, $conn) or die(mysql_error());
    		//END ADD THIS TO BATYA				
    				} 
    				else {
    					echo stripslashes(get_option('wpsb_msg_fail'));
    				}
    			}
    		}
    	}
    }
    echo stripslashes(get_option('wpsb_form_footer'));
    }
    
    
    function wpsb_dbl_optin_confirm() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    $email = stripslashes(get_option('wpsb_email_from'));
    $wpsb_auto_delete = get_option('wpsb_auto_delete');
    $sql = "SELECT * FROM `". $table_users . "` WHERE `time` = '" . $_GET['wpsb_d'] . "' AND MD5(CONCAT(`email`, `ip`)) = '" . $_GET['wpsb_s'] ."' AND `msg_sent` = '0'";
    $res = $wpdb->get_results($sql);
    if (sizeof($res)) {
    	$record = $res[0];
    	$headers = "MIME-Version: 1.0\n";
    	$headers .= "From: ". $record->email."\n";
    	$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    	if (mail($email, "Subscribe", $record->custom_data, $headers)) {
    		if ($wpsb_auto_delete) {
    			$update = "DELETE FROM `$table_users` WHERE `id` = ". $record->id;
    		}
    		else {
    			$update = "UPDATE `$table_users` SET `msg_sent` = '1' WHERE `id` = ". $record->id;
    		}
    		$res = $wpdb->query($update);
    		echo stripslashes(get_option('wpsb_dbl_sent'));
    	}
    	else {
    		echo stripslashes(get_option('wpsb_msg_fail'));
    	}
    }
    else {
    	echo stripslashes(get_option('wpsb_dbl_fail'));
    }
    }
    
    
    function wpsb_install() {
    global $wpdb;
    global $wpsb_db_version;
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    if($wpdb->get_var("show tables like '$table_users'") != $table_users) {
    
    
    	// Table did not exist; create new
    	$sql = "CREATE TABLE `" . $table_users . "` (
      			`id` mediumint(9) NOT NULL auto_increment,
      			`time` bigint(11) NOT NULL default '0',
      			`ip` varchar(50) NOT NULL default '',
    			`email` varchar(50) NOT NULL default '',
      			`msg_sent` enum('0','1') NOT NULL default '0',
      			`custom_data` text NOT NULL,
      			UNIQUE KEY `id` (`id`)
    	);";
    	$result = $wpdb->query($sql);
    	//require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    	//dbDelta($sql);
    
    
    	// Insert initial data in table
    	$insert = "INSERT INTO `$table_users` (`time`, `ip`, `email`, `msg_sent`) " .
    		"VALUES ('" . time() . "','" . wpsb_getip() .
    		"','" . get_option('admin_email') . "', '1')";
    	$result = $wpdb->query($insert);
    
    
    	add_option("wpsb_db_version", $wpsb_db_version);
    
    
    	// Initialise options with default values
    	$blogname = get_option('blogname');
    	add_option('wpsb_widget_title', 'Choose a title for the widget');
    	add_option('wpsb_email_from', get_option('admin_email') );
    	add_option('wpsb_email_subject', "[$blogname] Mailing list subscription");
    	add_option('wpsb_email_message', "This is an automatic response to a subscription request started at $blogname.\nThanks for subscribing.\n\n#link#");
    	add_option('wpsb_double_optin', "1");
    	add_option('wpsb_link_love', "1");
    	add_option('wpsb_auto_delete', "0");
    
    	add_option('wpsb_msg_bad', "<p>Bad e-mail address.</p>");
    	add_option('wpsb_msg_dbl', "<p>E-mail address already subscribed.</p>");
    	add_option('wpsb_msg_fail', "<p>Failed sending to e-mail address.</p>");
    	add_option('wpsb_msg_sent', "<p>Thanks for subscribing.</p>");
    	add_option('wpsb_dbl_fail', "<p>E-mail address not found or already confirmed.</p>");
    	add_option('wpsb_dbl_sent', "<p>Subscription confirmed. Thank you.</p>");
    
    
    	add_option('wpsb_form_header', "<a name=\"wpsbw\"></a><div class=\"widget module\">You may want to put some text here");
    	add_option('wpsb_form_footer', "<>");
    	add_option('wpsb_form_email', "E-mail:");
    	//add_option('wpsb_form_fields', "");
    	add_option('wpsb_form_fields', array("wpsb_radio_in"=>"Subscribe","wpsb_radio_out"=>"Unsubscribe"));
    	add_option('wpsb_form_send', "Submit");
    }
    }
    
    
    function wpsb_options() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    // Handle options from get method information
    if (isset($_GET['user_id'])) {
    	$user_id = $_GET['user_id'];
    
    
    	// Delete user from database
    	$delete = "DELETE FROM " . $table_users .
    			" WHERE id = '" . $user_id . "'";
    	$result = $wpdb->query($delete);
    
    
    	// Notify admin of delete
    	echo '<div id="message" class="updated fade"><p><strong>';
    	_e('User deleted.', 'wpsb_domain');
    	echo '</strong></p><>';
    }
    
    if (isset($_GET['purge'])) {
    	$goOn = false;
    	switch (intval($_GET['purge'])) {
    		case 1:
    			// all
    			$to_del = "1";
    			$goOn = true;
    			break;
    		case 2:
    			// older than 1 week
    			$to_del = "`time` < " . strtotime("-1 week");
    			$goOn = true;
    			break;
    		case 3:
    			// older than 2 weeks
    			$to_del = "`time` < " . strtotime("-2 weeks");
    			$goOn = true;
    			break;
    		case 4:
    			// older than 1 month
    			$to_del = "`time` < " . strtotime("-1 month");
    			$goOn = true;
    			break;
    	}
    	if ($goOn) {
    		// Delete user from database
    		$delete = "DELETE FROM `" . $table_users .
    				"` WHERE " . $to_del . " AND `msg_sent` = '0'";
    		$result = $wpdb->query($delete);
    
    		// Notify admin of delete
    		echo '<div id="message" class="updated fade"><p><strong>';
    		_e($result .' user(s) deleted.', 'wpsb_domain');
    		echo '</strong></p><>';
    	}
    }
    
    
    // Get current options from database
    $email_from = stripslashes(get_option('wpsb_email_from'));
    $email_subject = stripslashes(get_option('wpsb_email_subject'));
    $email_message = stripslashes(get_option('wpsb_email_message'));
    $double_optin = get_option('wpsb_double_optin');
    $link_love = get_option('wpsb_link_love');
    $auto_delete = get_option('wpsb_auto_delete');
    $msg_bad = stripslashes(get_option('wpsb_msg_bad'));
    $msg_dbl = stripslashes(get_option('wpsb_msg_dbl'));
    $msg_fail = stripslashes(get_option('wpsb_msg_fail'));
    $msg_sent = stripslashes(get_option('wpsb_msg_sent'));
    $dbl_fail = stripslashes(get_option('wpsb_dbl_fail'));
    $dbl_sent = stripslashes(get_option('wpsb_dbl_sent'));
    
    
    $form_header = stripslashes(get_option('wpsb_form_header'));
    $form_footer = stripslashes(get_option('wpsb_form_footer'));
    $form_email = stripslashes(get_option('wpsb_form_email'));
    $form_fields = (get_option('wpsb_form_fields'));
    $form_send = stripslashes(get_option('wpsb_form_send'));
    
    
    // Update options if user posted new information
    if( $_POST['wpsb_hidden'] == 'SAb13c' ) {
    	// Read from form
    	$email_from = stripslashes($_POST['wpsb_email_from']);
    	$email_subject = stripslashes($_POST['wpsb_email_subject']);
    	$email_message = stripslashes($_POST['wpsb_email_message']);
    	$double_optin = (int) isset($_POST['wpsb_double_optin']);
    	$link_love = (int) isset($_POST['wpsb_link_love']);
    	$auto_delete = (int) isset($_POST['wpsb_auto_delete']);
    	$msg_bad = stripslashes($_POST['wpsb_msg_bad']);
    	$msg_dbl = stripslashes($_POST['wpsb_msg_dbl']);
    	$msg_fail = stripslashes($_POST['wpsb_msg_fail']);
    	$msg_sent = stripslashes($_POST['wpsb_msg_sent']);
    	$dbl_fail = stripslashes($_POST['wpsb_dbl_fail']);
    	$dbl_sent = stripslashes($_POST['wpsb_dbl_sent']);
    
    
    	$form_header = stripslashes($_POST['wpsb_form_header']);
    	$form_footer = stripslashes($_POST['wpsb_form_footer']);
    	$form_email = stripslashes($_POST['wpsb_form_email']);
    	$form_fields = is_array($_POST['wpsb_form_fld']) ? $_POST['wpsb_form_fld'] : array();
    	$form_send = stripslashes($_POST['wpsb_form_send']);
    
    
    	// Save to database
    	update_option('wpsb_email_from', $email_from );
    	update_option('wpsb_email_subject', $email_subject);
    	update_option('wpsb_email_message', $email_message);
    	update_option('wpsb_double_optin', $double_optin);
    	update_option('wpsb_link_love', $link_love);
    	update_option('wpsb_auto_delete', $auto_delete);
    
    
    	update_option('wpsb_msg_bad', $msg_bad);
    	update_option('wpsb_msg_dbl', $msg_dbl);
    	update_option('wpsb_msg_fail', $msg_fail);
    	update_option('wpsb_msg_sent', $msg_sent);
    	update_option('wpsb_dbl_fail', $dbl_fail);
    	update_option('wpsb_dbl_sent', $dbl_sent);
    
    
    	update_option('wpsb_form_header', $form_header);
    	update_option('wpsb_form_footer', $form_footer);
    	update_option('wpsb_form_email', $form_email);
    	update_option('wpsb_form_fields', ($form_fields));
    	update_option('wpsb_form_send', $form_send);
    
    
    	// Notify admin of change
    	echo '<div id="message" class="updated fade"><p><strong>';
    	_e('Options saved.', 'wpsb_domain');
    	echo '</strong></p><>';
    }
    ?>
    <div class="wrap">
      <h2>Newsletter subscription Double Opt-in Options</h2>
    <form method="post" action="">
        <fieldset class="options"> <legend>General settings</legend> 
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Mailbox for managing subscriptions:</th>
            <td> 
              <p>
    	    <input type="hidden" name="wpsb_hidden" value="SAb13c" />
                <input type="text" name="wpsb_email_from" id="wpsb_email_from" value="<?php echo $email_from; ?>" size="40" />
              </p>
              <p><em>Note for <a href="http://www.sendblaster.com" title="Free newsletter software">SendBlaster</a> 
                users</em>: this is the main parameter you have to insert inside <a href="http://www.sendblaster.com/bulk-email-software/wp-content/manage-subscriptions.gif">SendBlaster 
                Manage Subscription</a> section</p>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Message to subscriber, subject:</th>
            <td> 
              <input type="text" name="wpsb_email_subject" id="wpsb_email_subject" value="<?php echo $email_subject; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Message to subscriber, content:</th>
            <td> 
              <p> 
                <textarea name="wpsb_email_message" id="wpsb_email_message" rows="4" cols="40"><?php echo $email_message; ?></textarea>
              </p>
              <p> Use the #link# placeholder where you want the URL for confirming 
                subscription to appear (only if double opt-in is checked). </p>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double Opt-in:</th>
            <td> 
              <input type="checkbox" name="wpsb_double_optin" id="wpsb_double_optin" value="1"<?php echo $double_optin ? " checked=\"checked\"" : "";?> />
              If checked you will receive subscribing emails only when user clicks 
              on the appropriate link inside confirmation message.</td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Link Love:</th>
            <td> 
              <input type="checkbox" name="wpsb_link_love" id="wpsb_link_love" value="1"<?php echo $link_love ? " checked=\"checked\"" : "";?> />
              If unchecked removes Plugin credits from sidebar.</td>
          </tr>
          <tr valign="top">
            <th scope="row">Delete subscribed users:</th>
            <td>
              <input type="checkbox" name="wpsb_auto_delete" id="wpsb_auto_delete" value="1"<?php echo $auto_delete ? " checked=\"checked\"" : "";?> />
              If checked automatically removes users upon their subscription (use 
              only if you download your subscriptions daily)</td>
          </tr>
          <tr valign="top"> 
            <td colspan="2"> </td>
          </tr>
        </table>
        </fieldset> <fieldset class="options"> <legend>Front side messages</legend> 
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Bad e-mail address:</th>
            <td> 
              <input type="text" name="wpsb_msg_bad" id="wpsb_msg_bad" value="<?php echo $msg_bad; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top">
            <th scope="row">Duplicate e-mail address:</th>
            <td>
              <input type="text" name="wpsb_msg_dbl" id="wpsb_msg_dbl" value="<?php echo $msg_dbl; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Failed to send:</th>
            <td> 
              <input type="text" name="wpsb_msg_fail" id="wpsb_msg_fail" value="<?php echo $msg_fail; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Success:</th>
            <td> 
              <input type="text" name="wpsb_msg_sent" id="wpsb_msg_sent" value="<?php echo $msg_sent; ?>" size="40" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Unsubscribe success:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_unsubscr_success]" id="wpsb_unsubscr_success" value="<?php echo $form_fields['wpsb_unsubscr_success']; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double opt-in failure:</th>
            <td>
              <input type="text" name="wpsb_dbl_fail" id="wpsb_dbl_fail" value="<?php echo $dbl_fail; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double opt-in success:</th>
            <td>
              <input type="text" name="wpsb_dbl_sent" id="wpsb_dbl_sent" value="<?php echo $dbl_sent; ?>" size="40" />
            </td>
          </tr>
        </table>
        </fieldset> <fieldset class="options"> 
        <legend>Front side form appearance and labels</legend>
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Form header:</th>
            <td> 
              <textarea name="wpsb_form_header" id="wpsb_form_header" rows="4" cols="40"><?php echo $form_header; ?></textarea>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Form footer:</th>
            <td> 
              <textarea name="wpsb_form_footer" id="wpsb_form_footer" rows="2" cols="40"><?php echo $form_footer; ?></textarea>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">E-mail (mandatory: field #1)</th>
            <td> <p> 
                <input type="text" name="wpsb_form_email" id="wpsb_form_email" value="<?php echo $form_email; ?>" size="40" maxlength="64" /></p><p>First field (E-mail) is mandatory and cannot be removed <br />
                Leave blank to <strong>disable</strong> other custom fields, <br />
                Writing label names will <strong>enable</strong> the custom fields.</p></td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Custom field #2:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[2]" id="wpsb_form_fld2" value="<?php echo $form_fields[2]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #3:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[3]" id="wpsb_form_fld3" value="<?php echo $form_fields[3]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #4:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[4]" id="wpsb_form_fld4" value="<?php echo $form_fields[4]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #5:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[5]" id="wpsb_form_fld5" value="<?php echo $form_fields[5]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #6:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[6]" id="wpsb_form_fld6" value="<?php echo $form_fields[6]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #7:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[7]" id="wpsb_form_fld7" value="<?php echo $form_fields[7]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #8:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[8]" id="wpsb_form_fld8" value="<?php echo $form_fields[8]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #9:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[9]" id="wpsb_form_fld9" value="<?php echo $form_fields[9]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #10:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[10]" id="wpsb_form_fld10" value="<?php echo $form_fields[10]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #11:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[11]" id="wpsb_form_fld11" value="<?php echo $form_fields[11]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #12:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[12]" id="wpsb_form_fld12" value="<?php echo $form_fields[12]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #13:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[13]" id="wpsb_form_fld13" value="<?php echo $form_fields[13]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #14:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[14]" id="wpsb_form_fld14" value="<?php echo $form_fields[14]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #15:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[15]" id="wpsb_form_fld15" value="<?php echo $form_fields[15]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Subscribe label:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_radio_in]" id="wpsb_form_fld16" value="<?php echo $form_fields['wpsb_radio_in']; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Unsubscribe label:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_radio_out]" id="wpsb_form_fld17" value="<?php echo $form_fields['wpsb_radio_out']; ?>" size="40" maxlength="64" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Submit button:</th>
            <td> 
              <input type="text" name="wpsb_form_send" id="wpsb_form_send" value="<?php echo $form_send; ?>" size="40" maxlength="64" />
            </td>
          </tr>
          <tr valign="top"> 
            <td colspan="2" scope="row"> </td>
          </tr>
        </table>
    </fieldset>
    <p class="submit">
    <input type="submit" name="Submit" value="Update Options »" />
    </p>
    </form>
    <>
    <div class="wrap">
    <h2>Temp Opted-in users backup</h2>
      <p>Delete users from this panel once you have downloaded subscriptions with 
        your mailing list software. <br />
    </p>
    <?php
    if ($users = $wpdb->get_results("SELECT * FROM $table_users WHERE `msg_sent` = '1' ORDER BY `id` DESC")) {
    ?>
    <h3>Bcc friendly format:</h3>
    <p>
    <?php
    	$additional_user=0;
    	foreach ($users as $user) {
    		if ($user->msg_sent == "1") {
    			if ($additional_user) {
    				echo ', ';
    			}
    			$additional_user=1;
    			echo $user->email;
    		}
    	}	
    ?>
    </p>
    <?php
    }
    if ($users = $wpdb->get_results("SELECT * FROM $table_users ORDER BY `id` DESC")) {
    	$user_no=0;
    	//$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . basename(dirname(__FILE__)). '/' . basename(__FILE__);
    	$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . $_GET['page'];
    ?>
    <table class="widefat">
    <thead>    
    <tr align="right"> 
          <td colspan="6">
        <script type="text/javascript"> 
    		//<![CDATA[
    		function confirm_purge (frm) {
    			if(frm.purge.selectedIndex != 0 && confirm('Are you sure you want to proceed?')) {
    				top.location.href='<?php echo $url; ?>&purge=' + frm.purge.options[frm.purge.selectedIndex].value;
    			}
    		}
    		//]]>
    	</script>
            <form method="get" action="">
    	  <fieldset class="options">Purge non opted-in users: 
              <select name="purge" id="purge">
                <option value="0">Select...</option>
                <option value="1">All</option>
                <option value="2">Older than 1 week</option>
                <option value="3">Older than 2 weeks</option>
                <option value="4">Older than 1 month</option>
              </select>
              <input type="button" name="prg_btn" id="prg_btn" value="Go" onclick="confirm_purge(this.form)" />
    	  </fieldset>
    	</form>
      </td>
    </tr>
    <tr>
    <th scope="col">ID</th>
    <th scope="col">Date/Time</th>
    <th scope="col">Opted-in</th>
    <th scope="col">IP</th>
    <th scope="col">E-mail</th>
    <th scope="col">Action</th>
    </tr>
    </thead>
    <tbody>
    <?php
    	$url = $url . '&user_id=';
    	foreach ($users as $user) {
    		if ($user_no&1) {
    			echo "<tr class=\"alternate\">";
    		} else {
    			echo "<tr>";
    		}
    		$user_no=$user_no+1;
    		echo "<td>$user->id</td>";
    		echo "<td>" . date(get_option('date_format'), $user->time). " " . date(get_option('time_format'), $user->time) . "</td>";
    		echo "<td>";
    		echo $user->msg_sent ? "Yes" : "No";
    		echo "</td>";
    		echo "<td>$user->ip</td>";
    		echo "<td>$user->email</td>";
    		echo "<td><a href=\"$url$user->id\" onclick=\"if(confirm('Are you sure you want to delete user with ID $user->id?')) return; else return false;\">Delete</a></td>";
    		echo "</tr>";
    	}
    ?>
    </tbody>
    </table>
    <p><em>ToolTip</em>: to insert the module in a page: 1) install the <a href="http://wordpress.org/extend/plugins/exec-php/">exec php</a> plugin; 2) insert this code in your pages: <?php wpsb_opt_in(); ?></p><>
    <?php
    }
    }
    
    
    function wpsb_widget_init() {
    global $wp_version;
    
    
    if (!function_exists('register_sidebar_widget')) {
    	return;
    }
    
    
    function wpsb_widget($args) {
    	extract($args);
    	echo $before_widget . $before_title;
    	echo get_option('wpsb_widget_title');
    	echo $after_title;
    	wpsb_opt_in();
    	echo $after_widget;
    }
    
    
    function wpsb_widget_control() {
    	$title = get_option('wpsb_widget_title');
    	if ($_POST['wpsb_submit']) {
    		$title = stripslashes($_POST['wpsb_widget_title']);
    		update_option('wpsb_widget_title', $title );
    	}
    	echo '<p>Title:<input  style="width: 200px;" type="text" value="';
    	echo $title . '" name="wpsb_widget_title" id="wpsb_widget_title" /></p>';
    	echo '<input type="hidden" id="wpsb_submit" name="wpsb_submit" value="1" />';
    }
    
    
    $width = 300;
    $height = 100;
    if ( '2.2' == $wp_version || (!function_exists( 'wp_register_sidebar_widget' ))) {
    	register_sidebar_widget('WP SendBlaster Opt-in', 'wpsb_widget');
    	register_widget_control('WP SendBlaster Opt-in', 'wpsb_widget_control', $width, $height);
    } else {
    	// v2.2.1+
    	$size = array('width' => $width, 'height' => $height);
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    	wp_register_sidebar_widget('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget', $class);
    	wp_register_widget_control('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget_control', $size);
    }
    if (function_exists('register_sidebar_module')) {
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    	register_sidebar_module('WP SendBlaster Opt-in', 'wpsb_widget', '', $class);
    	register_sidebar_module_control('WP SendBlaster Opt-in', 'wpsb_widget_control');
    
    
    }
    }
    
    
    function wpsb_add_to_menu() {
    add_options_page('WP SendBlaster Opt-in Options', 'WP SendBlaster Opt-in', 7, __FILE__, 'wpsb_options' );
    }
    
    
    function wpsb_insert ($cnt) {
     global $wpsb_ob;
     $cnt = str_replace("<!--wpsb-opt-in-->", $wpsb_ob, $cnt);
     return $cnt;
    }
    
    
    
    
    register_activation_hook(__FILE__, 'wpsb_install');
    add_action('admin_menu', 'wpsb_add_to_menu');
    add_action('init', 'wpsb_widget_init');
    
    
    ?>
    

  5. It is not random, it's always #2# because it is the 2nd customized field in the plugin, and I would love to remove it before inserting it, but I couldn't figure it out. Here is the code for when it gets inserted:

     

     

    
    //connect to server and select database
    $conn = mysql_connect("localhost", "username", "password") or die(mysql_error());
    mysql_select_db("database", $conn) or die(mysql_error());
                         $insert1 = "INSERT INTO wp_users VALUES ('', '', '', '', '$email', '', NOW(), '', '', '$wpsb_custom_flds')";
                         $result2 = mysql_query($insert1, $conn) or die(mysql_error());
                
    

     

     

    Here is the entire file. Maybe if someone could tell me how i can obtain the data from the second custom field, without the #2# in it, that would be even better. If not, then I would like to know how to remove the #2# when I display the field.

     

     

    
    
    <?php
    /*
    Plugin Name: Wordpress Newsletter subscription Opt-in for SendBlaster
    Plugin URI: http://www.sendblaster.com/wordpress-newsletter-double-optin-widget/
    Description: Create a simple form to collect subscription requests to newsletter software managed mailing lists. User input is stored in the db and sent by e-mail in a format compatible with common newsletter softwares' data structure and subscription management.
    Version: 1.1.6
    Author: Max
    Author URI: http://www.sendblaster.com/
    */
    
    
    /*
    
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.
    
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    */
    
    
    $wpsb_db_version = "0.1";
    
    
    
    
    function wpsb_show_form($rtn = 0) {	
    $wpsb_flds = (get_option('wpsb_form_fields'));
    $add_link_lv = get_option("wpsb_link_love");
    $out = '<form action="#wpsbw" method="post">' . "\n";
    $out .= '<p class="wpsb_form_label">' . get_option('wpsb_form_email');
    $out .= '<br /> <input type="text" name="wpsb_email" id="wpsb_email" class="wpsb_form_txt" /></p>' . "\n";
    if (is_array($wpsb_flds)) {
    	foreach ($wpsb_flds as $wpsb_k => $wpsb_v) {
    		if (is_numeric($wpsb_k) && $wpsb_v) {
    			$out .= '<p class="wpsb_form_label">' . $wpsb_v;
    			$out .= ' <input type="text" name="wpsb_fld['. $wpsb_k .']" id="wpsb_fld_'. $wpsb_k .'"  maxlength="64" class="wpsb_form_txt" /></p>' . "\n";
    		}
    	}
    }
    $out .= '<script type="text/javascript">
    //<![CDATA[	
    	function wpsb_toggle_custom_fields (state) {
    		for (i=2; i<16; i++) {
    			if (obj = document.getElementById(\'wpsb_fld_\'+i)) {
    				obj.disabled = !state;
    				obj.readOnly = !state;
    			}
    		}
    	}
    //]]>
    </script>
    ';
    $out .= '<p class="wpsb_form_label"><input type="radio" name="wpsb_radio_option" id="wpsb_radio_option1" onclick="wpsb_toggle_custom_fields(1)" class="wpsb_form_radio" value="wpsb_radio_in" checked="checked" /> '.$wpsb_flds['wpsb_radio_in'];
    $out .= '<br/>';
    $out .= '<input type="radio" name="wpsb_radio_option" id="wpsb_radio_option2" onclick="wpsb_toggle_custom_fields(0)" class="wpsb_form_radio" value="wpsb_radio_out" /> '.$wpsb_flds['wpsb_radio_out'].'</p>';
    
    $out .= '<p class="wpsb_form_label"><input type="submit" value="' . get_option('wpsb_form_send');
    $out .= '" class="wpsb_form_btn" /></p>' . "\n</form>\n<!-- Made by www.SendBlaster.com Newsletter Software Opt-in -->\n";
    if ($add_link_lv) {
    	$out .= "<h6>Get this <a href=\"http://wordpress.org/extend/plugins/newsletter-subscription-double-optin/\" title=\"Wordpress newsletter plugin\">Wordpress newsletter widget</a><br /> for <a href=\"http://www.sendblaster.com/newsletter-software-no-recurring-fees/\" title=\"newsletter softwares\">newsletter software</a></h6>";
    }
    if ($rtn) {
    	return $out;
    }
    else {
    	echo $out;
    }
    }
    
    
    function wpsb_getip() {
    if (isset($_SERVER)) {
    	if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    		$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
    	} 
    	elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
    		$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
    	} 
    	else {
    		$ip_addr = $_SERVER["REMOTE_ADDR"];
    	}
    } 
    else {
    	if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
    		$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );
    	} 
    	elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
    		$ip_addr = getenv( 'HTTP_CLIENT_IP' );
    	} 
    	else {
    		$ip_addr = getenv( 'REMOTE_ADDR' );
    	}
    }
    return $ip_addr;
    }
    
    
    function wpsb_has_email_headers($text) {
       return preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i", $text);
    }
    
    
    function wpsb_opt_in() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    echo stripslashes(get_option('wpsb_form_header'));
    
    
    $_POST['wpsb_email'] = trim($_POST['wpsb_email']);
    if (empty($_POST['wpsb_email'])) {
    	if (!empty($_GET['wpsb_d']) && !empty($_GET['wpsb_s'])) {
    		wpsb_dbl_optin_confirm();
    	}
    	else {
    		wpsb_show_form();
    	}
    } 
    else {
    	$email = stripslashes($_POST['wpsb_email']);
    	$wpsb_custom_flds = "";
    	if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
    			echo stripslashes(get_option('wpsb_msg_bad'));
    			wpsb_show_form();
    	}
    	else {
    		if ($_POST['wpsb_radio_option'] && $_POST['wpsb_radio_option'] == "wpsb_radio_out") {
    			$manager_email = stripslashes(get_option('wpsb_email_from'));
    			$wpsb_flds = (get_option('wpsb_form_fields'));
    			$headers = "MIME-Version: 1.0\n";
    			$headers .= "From: $email\n";
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    			if (mail($manager_email, "Unsubscribe", "", $headers)) {
    				echo stripslashes($wpsb_flds['wpsb_unsubscr_success']);
    			} 
    			else {
    				echo stripslashes(get_option('wpsb_msg_fail'));
    			}
    		}
    		else {
    			$wpsb_double_optin = get_option('wpsb_double_optin');
    			$wpsb_auto_delete = get_option('wpsb_auto_delete');
    			if (!empty($_POST['wpsb_fld'])) {
    				foreach ($_POST['wpsb_fld'] as $wpsb_k => $wpsb_v) {
    					if (ereg("^[ ]*([^\t\r\n\\]{1,64}[^ ])[ ]*$", stripslashes($wpsb_v), $wpsb_r)) {
    						$wpsb_custom_flds .= "#".$wpsb_k."#: ".$wpsb_r[1]."\n";
    					}
    				}
    			}
    			$email_from = stripslashes(get_option('wpsb_email_from'));
    			$subject = stripslashes(get_option('wpsb_email_subject'));
    			$message = stripslashes(get_option('wpsb_email_message'));
    
    			$headers = "MIME-Version: 1.0\n";
    			$headers .= "From: $email_from\n";
    			$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    
    			$wpsb_time = time();
    			$wpsb_ip = wpsb_getip();
    			if ($wpsb_double_optin == 1) {
    				$wpsb_link = Array ("scheme" => "http", "host" => $_SERVER['HTTP_HOST'], "port" => "", "user" => "", "pass" => "", "path" => "", "query" => "", "fragment" => "");
    				$wpsb_link += parse_url(get_bloginfo('wpurl'));
    				$wpsb_optin_url = $wpsb_link['scheme']."://".$wpsb_link['host'].$_SERVER['SCRIPT_NAME']."?wpsb_d=".$wpsb_time."&wpsb_s=".md5($email.$wpsb_ip)."#wpsbw";
    				$message = str_replace('#link#', $wpsb_optin_url, $message);
    			}
    			$selectqry = "SELECT * FROM " . $table_users . " WHERE `email` = '" . $email ."'";
    			if ($wpdb->query($selectqry)) {
    				echo stripslashes(get_option('wpsb_msg_dbl'));
    			}
    			else {
    				if (mail($email,$subject,$message,$headers)) {
    					if ($wpsb_double_optin || !$wpsb_auto_delete) {
    						// Write new user to database
    //BATYA WAS HERE
    
    						$insert = "INSERT INTO " . $table_users . " 
    							(time, ip, email, msg_sent, custom_data) 
    							VALUES (
    							'" . $wpsb_time . "',
    							'" . $wpsb_ip . "',
    							'" . $email . "',
    							'" . (int) !$wpsb_double_optin ."',
    							'" . $wpsb_custom_flds . "'
    							)";
    					 	$result = $wpdb->query($insert);
    					}
    					if (!$wpsb_double_optin) {
    						$headers = "MIME-Version: 1.0\n";
    						$headers .= "From: $email\n";
    						$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    						mail($email_from, "Subscribe", $wpsb_custom_flds, $headers);
    					}
    					//echo stripslashes(get_option('wpsb_msg_sent'));
    					echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://webdesignsbyliz.com/blog/?page_id=2">';
    
    
    //connect to server and select database
    $conn = mysql_connect("localhost", "username", "password") or die(mysql_error());
    mysql_select_db("database", $conn) or die(mysql_error());
    						$insert1 = "INSERT INTO wp_users VALUES ('', '', '', '', '$email', '', NOW(), '', '', '$wpsb_custom_flds')";
    						$result2 = mysql_query($insert1, $conn) or die(mysql_error());
    
    				} 
    				else {
    					echo stripslashes(get_option('wpsb_msg_fail'));
    				}
    			}
    		}
    	}
    }
    echo stripslashes(get_option('wpsb_form_footer'));
    }
    
    
    function wpsb_dbl_optin_confirm() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    $email = stripslashes(get_option('wpsb_email_from'));
    $wpsb_auto_delete = get_option('wpsb_auto_delete');
    $sql = "SELECT * FROM `". $table_users . "` WHERE `time` = '" . $_GET['wpsb_d'] . "' AND MD5(CONCAT(`email`, `ip`)) = '" . $_GET['wpsb_s'] ."' AND `msg_sent` = '0'";
    $res = $wpdb->get_results($sql);
    if (sizeof($res)) {
    	$record = $res[0];
    	$headers = "MIME-Version: 1.0\n";
    	$headers .= "From: ". $record->email."\n";
    	$headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    	if (mail($email, "Subscribe", $record->custom_data, $headers)) {
    		if ($wpsb_auto_delete) {
    			$update = "DELETE FROM `$table_users` WHERE `id` = ". $record->id;
    		}
    		else {
    			$update = "UPDATE `$table_users` SET `msg_sent` = '1' WHERE `id` = ". $record->id;
    		}
    		$res = $wpdb->query($update);
    		echo stripslashes(get_option('wpsb_dbl_sent'));
    	}
    	else {
    		echo stripslashes(get_option('wpsb_msg_fail'));
    	}
    }
    else {
    	echo stripslashes(get_option('wpsb_dbl_fail'));
    }
    }
    
    
    function wpsb_install() {
    global $wpdb;
    global $wpsb_db_version;
    
    
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    if($wpdb->get_var("show tables like '$table_users'") != $table_users) {
    
    
    	// Table did not exist; create new
    	$sql = "CREATE TABLE `" . $table_users . "` (
      			`id` mediumint(9) NOT NULL auto_increment,
      			`time` bigint(11) NOT NULL default '0',
      			`ip` varchar(50) NOT NULL default '',
    			`email` varchar(50) NOT NULL default '',
      			`msg_sent` enum('0','1') NOT NULL default '0',
      			`custom_data` text NOT NULL,
      			UNIQUE KEY `id` (`id`)
    	);";
    	$result = $wpdb->query($sql);
    	//require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    	//dbDelta($sql);
    
    
    	// Insert initial data in table
    	$insert = "INSERT INTO `$table_users` (`time`, `ip`, `email`, `msg_sent`) " .
    		"VALUES ('" . time() . "','" . wpsb_getip() .
    		"','" . get_option('admin_email') . "', '1')";
    	$result = $wpdb->query($insert);
    
    
    	add_option("wpsb_db_version", $wpsb_db_version);
    
    
    	// Initialise options with default values
    	$blogname = get_option('blogname');
    	add_option('wpsb_widget_title', 'Choose a title for the widget');
    	add_option('wpsb_email_from', get_option('admin_email') );
    	add_option('wpsb_email_subject', "[$blogname] Mailing list subscription");
    	add_option('wpsb_email_message', "This is an automatic response to a subscription request started at $blogname.\nThanks for subscribing.\n\n#link#");
    	add_option('wpsb_double_optin', "1");
    	add_option('wpsb_link_love', "1");
    	add_option('wpsb_auto_delete', "0");
    
    	add_option('wpsb_msg_bad', "<p>Bad e-mail address.</p>");
    	add_option('wpsb_msg_dbl', "<p>E-mail address already subscribed.</p>");
    	add_option('wpsb_msg_fail', "<p>Failed sending to e-mail address.</p>");
    	add_option('wpsb_msg_sent', "<p>Thanks for subscribing.</p>");
    	add_option('wpsb_dbl_fail', "<p>E-mail address not found or already confirmed.</p>");
    	add_option('wpsb_dbl_sent', "<p>Subscription confirmed. Thank you.</p>");
    
    
    	add_option('wpsb_form_header', "<a name=\"wpsbw\"></a><div class=\"widget module\">You may want to put some text here");
    	add_option('wpsb_form_footer', "<>");
    	add_option('wpsb_form_email', "E-mail:");
    	//add_option('wpsb_form_fields', "");
    	add_option('wpsb_form_fields', array("wpsb_radio_in"=>"Subscribe","wpsb_radio_out"=>"Unsubscribe"));
    	add_option('wpsb_form_send', "Submit");
    }
    }
    
    
    function wpsb_options() {
    global $wpdb;
    $table_users = $wpdb->prefix . "wpsb_users";
    
    
    // Handle options from get method information
    if (isset($_GET['user_id'])) {
    	$user_id = $_GET['user_id'];
    
    
    	// Delete user from database
    	$delete = "DELETE FROM " . $table_users .
    			" WHERE id = '" . $user_id . "'";
    	$result = $wpdb->query($delete);
    
    
    	// Notify admin of delete
    	echo '<div id="message" class="updated fade"><p><strong>';
    	_e('User deleted.', 'wpsb_domain');
    	echo '</strong></p><>';
    }
    
    if (isset($_GET['purge'])) {
    	$goOn = false;
    	switch (intval($_GET['purge'])) {
    		case 1:
    			// all
    			$to_del = "1";
    			$goOn = true;
    			break;
    		case 2:
    			// older than 1 week
    			$to_del = "`time` < " . strtotime("-1 week");
    			$goOn = true;
    			break;
    		case 3:
    			// older than 2 weeks
    			$to_del = "`time` < " . strtotime("-2 weeks");
    			$goOn = true;
    			break;
    		case 4:
    			// older than 1 month
    			$to_del = "`time` < " . strtotime("-1 month");
    			$goOn = true;
    			break;
    	}
    	if ($goOn) {
    		// Delete user from database
    		$delete = "DELETE FROM `" . $table_users .
    				"` WHERE " . $to_del . " AND `msg_sent` = '0'";
    		$result = $wpdb->query($delete);
    
    		// Notify admin of delete
    		echo '<div id="message" class="updated fade"><p><strong>';
    		_e($result .' user(s) deleted.', 'wpsb_domain');
    		echo '</strong></p><>';
    	}
    }
    
    
    // Get current options from database
    $email_from = stripslashes(get_option('wpsb_email_from'));
    $email_subject = stripslashes(get_option('wpsb_email_subject'));
    $email_message = stripslashes(get_option('wpsb_email_message'));
    $double_optin = get_option('wpsb_double_optin');
    $link_love = get_option('wpsb_link_love');
    $auto_delete = get_option('wpsb_auto_delete');
    $msg_bad = stripslashes(get_option('wpsb_msg_bad'));
    $msg_dbl = stripslashes(get_option('wpsb_msg_dbl'));
    $msg_fail = stripslashes(get_option('wpsb_msg_fail'));
    $msg_sent = stripslashes(get_option('wpsb_msg_sent'));
    $dbl_fail = stripslashes(get_option('wpsb_dbl_fail'));
    $dbl_sent = stripslashes(get_option('wpsb_dbl_sent'));
    
    
    $form_header = stripslashes(get_option('wpsb_form_header'));
    $form_footer = stripslashes(get_option('wpsb_form_footer'));
    $form_email = stripslashes(get_option('wpsb_form_email'));
    $form_fields = (get_option('wpsb_form_fields'));
    $form_send = stripslashes(get_option('wpsb_form_send'));
    
    
    // Update options if user posted new information
    if( $_POST['wpsb_hidden'] == 'SAb13c' ) {
    	// Read from form
    	$email_from = stripslashes($_POST['wpsb_email_from']);
    	$email_subject = stripslashes($_POST['wpsb_email_subject']);
    	$email_message = stripslashes($_POST['wpsb_email_message']);
    	$double_optin = (int) isset($_POST['wpsb_double_optin']);
    	$link_love = (int) isset($_POST['wpsb_link_love']);
    	$auto_delete = (int) isset($_POST['wpsb_auto_delete']);
    	$msg_bad = stripslashes($_POST['wpsb_msg_bad']);
    	$msg_dbl = stripslashes($_POST['wpsb_msg_dbl']);
    	$msg_fail = stripslashes($_POST['wpsb_msg_fail']);
    	$msg_sent = stripslashes($_POST['wpsb_msg_sent']);
    	$dbl_fail = stripslashes($_POST['wpsb_dbl_fail']);
    	$dbl_sent = stripslashes($_POST['wpsb_dbl_sent']);
    
    
    	$form_header = stripslashes($_POST['wpsb_form_header']);
    	$form_footer = stripslashes($_POST['wpsb_form_footer']);
    	$form_email = stripslashes($_POST['wpsb_form_email']);
    	$form_fields = is_array($_POST['wpsb_form_fld']) ? $_POST['wpsb_form_fld'] : array();
    	$form_send = stripslashes($_POST['wpsb_form_send']);
    
    
    	// Save to database
    	update_option('wpsb_email_from', $email_from );
    	update_option('wpsb_email_subject', $email_subject);
    	update_option('wpsb_email_message', $email_message);
    	update_option('wpsb_double_optin', $double_optin);
    	update_option('wpsb_link_love', $link_love);
    	update_option('wpsb_auto_delete', $auto_delete);
    
    
    	update_option('wpsb_msg_bad', $msg_bad);
    	update_option('wpsb_msg_dbl', $msg_dbl);
    	update_option('wpsb_msg_fail', $msg_fail);
    	update_option('wpsb_msg_sent', $msg_sent);
    	update_option('wpsb_dbl_fail', $dbl_fail);
    	update_option('wpsb_dbl_sent', $dbl_sent);
    
    
    	update_option('wpsb_form_header', $form_header);
    	update_option('wpsb_form_footer', $form_footer);
    	update_option('wpsb_form_email', $form_email);
    	update_option('wpsb_form_fields', ($form_fields));
    	update_option('wpsb_form_send', $form_send);
    
    
    	// Notify admin of change
    	echo '<div id="message" class="updated fade"><p><strong>';
    	_e('Options saved.', 'wpsb_domain');
    	echo '</strong></p><>';
    }
    ?>
    <div class="wrap">
      <h2>Newsletter subscription Double Opt-in Options</h2>
    <form method="post" action="">
        <fieldset class="options"> <legend>General settings</legend> 
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Mailbox for managing subscriptions:</th>
            <td> 
              <p>
    	    <input type="hidden" name="wpsb_hidden" value="SAb13c" />
                <input type="text" name="wpsb_email_from" id="wpsb_email_from" value="<?php echo $email_from; ?>" size="40" />
              </p>
              <p><em>Note for <a href="http://www.sendblaster.com" title="Free newsletter software">SendBlaster</a> 
                users</em>: this is the main parameter you have to insert inside <a href="http://www.sendblaster.com/bulk-email-software/wp-content/manage-subscriptions.gif">SendBlaster 
                Manage Subscription</a> section</p>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Message to subscriber, subject:</th>
            <td> 
              <input type="text" name="wpsb_email_subject" id="wpsb_email_subject" value="<?php echo $email_subject; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Message to subscriber, content:</th>
            <td> 
              <p> 
                <textarea name="wpsb_email_message" id="wpsb_email_message" rows="4" cols="40"><?php echo $email_message; ?></textarea>
              </p>
              <p> Use the #link# placeholder where you want the URL for confirming 
                subscription to appear (only if double opt-in is checked). </p>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double Opt-in:</th>
            <td> 
              <input type="checkbox" name="wpsb_double_optin" id="wpsb_double_optin" value="1"<?php echo $double_optin ? " checked=\"checked\"" : "";?> />
              If checked you will receive subscribing emails only when user clicks 
              on the appropriate link inside confirmation message.</td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Link Love:</th>
            <td> 
              <input type="checkbox" name="wpsb_link_love" id="wpsb_link_love" value="1"<?php echo $link_love ? " checked=\"checked\"" : "";?> />
              If unchecked removes Plugin credits from sidebar.</td>
          </tr>
          <tr valign="top">
            <th scope="row">Delete subscribed users:</th>
            <td>
              <input type="checkbox" name="wpsb_auto_delete" id="wpsb_auto_delete" value="1"<?php echo $auto_delete ? " checked=\"checked\"" : "";?> />
              If checked automatically removes users upon their subscription (use 
              only if you download your subscriptions daily)</td>
          </tr>
          <tr valign="top"> 
            <td colspan="2"> </td>
          </tr>
        </table>
        </fieldset> <fieldset class="options"> <legend>Front side messages</legend> 
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Bad e-mail address:</th>
            <td> 
              <input type="text" name="wpsb_msg_bad" id="wpsb_msg_bad" value="<?php echo $msg_bad; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top">
            <th scope="row">Duplicate e-mail address:</th>
            <td>
              <input type="text" name="wpsb_msg_dbl" id="wpsb_msg_dbl" value="<?php echo $msg_dbl; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Failed to send:</th>
            <td> 
              <input type="text" name="wpsb_msg_fail" id="wpsb_msg_fail" value="<?php echo $msg_fail; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Success:</th>
            <td> 
              <input type="text" name="wpsb_msg_sent" id="wpsb_msg_sent" value="<?php echo $msg_sent; ?>" size="40" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Unsubscribe success:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_unsubscr_success]" id="wpsb_unsubscr_success" value="<?php echo $form_fields['wpsb_unsubscr_success']; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double opt-in failure:</th>
            <td>
              <input type="text" name="wpsb_dbl_fail" id="wpsb_dbl_fail" value="<?php echo $dbl_fail; ?>" size="40" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Double opt-in success:</th>
            <td>
              <input type="text" name="wpsb_dbl_sent" id="wpsb_dbl_sent" value="<?php echo $dbl_sent; ?>" size="40" />
            </td>
          </tr>
        </table>
        </fieldset> <fieldset class="options"> 
        <legend>Front side form appearance and labels</legend>
        <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">
          <tr valign="top"> 
            <th scope="row">Form header:</th>
            <td> 
              <textarea name="wpsb_form_header" id="wpsb_form_header" rows="4" cols="40"><?php echo $form_header; ?></textarea>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Form footer:</th>
            <td> 
              <textarea name="wpsb_form_footer" id="wpsb_form_footer" rows="2" cols="40"><?php echo $form_footer; ?></textarea>
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">E-mail (mandatory: field #1)</th>
            <td> <p> 
                <input type="text" name="wpsb_form_email" id="wpsb_form_email" value="<?php echo $form_email; ?>" size="40" maxlength="64" /></p><p>First field (E-mail) is mandatory and cannot be removed <br />
                Leave blank to <strong>disable</strong> other custom fields, <br />
                Writing label names will <strong>enable</strong> the custom fields.</p></td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Custom field #2:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[2]" id="wpsb_form_fld2" value="<?php echo $form_fields[2]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #3:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[3]" id="wpsb_form_fld3" value="<?php echo $form_fields[3]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #4:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[4]" id="wpsb_form_fld4" value="<?php echo $form_fields[4]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #5:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[5]" id="wpsb_form_fld5" value="<?php echo $form_fields[5]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #6:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[6]" id="wpsb_form_fld6" value="<?php echo $form_fields[6]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #7:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[7]" id="wpsb_form_fld7" value="<?php echo $form_fields[7]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #8:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[8]" id="wpsb_form_fld8" value="<?php echo $form_fields[8]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #9:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[9]" id="wpsb_form_fld9" value="<?php echo $form_fields[9]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #10:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[10]" id="wpsb_form_fld10" value="<?php echo $form_fields[10]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #11:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[11]" id="wpsb_form_fld11" value="<?php echo $form_fields[11]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #12:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[12]" id="wpsb_form_fld12" value="<?php echo $form_fields[12]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #13:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[13]" id="wpsb_form_fld13" value="<?php echo $form_fields[13]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #14:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[14]" id="wpsb_form_fld14" value="<?php echo $form_fields[14]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Custom field #15:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[15]" id="wpsb_form_fld15" value="<?php echo $form_fields[15]; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Subscribe label:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_radio_in]" id="wpsb_form_fld16" value="<?php echo $form_fields['wpsb_radio_in']; ?>" size="40" maxlength="64" />
            </td>
          </tr>
      <tr valign="top"> 
            <th scope="row">Unsubscribe label:</th>
            <td> 
              <input type="text" name="wpsb_form_fld[wpsb_radio_out]" id="wpsb_form_fld17" value="<?php echo $form_fields['wpsb_radio_out']; ?>" size="40" maxlength="64" />
            </td>
          </tr>
          <tr valign="top"> 
            <th scope="row">Submit button:</th>
            <td> 
              <input type="text" name="wpsb_form_send" id="wpsb_form_send" value="<?php echo $form_send; ?>" size="40" maxlength="64" />
            </td>
          </tr>
          <tr valign="top"> 
            <td colspan="2" scope="row"> </td>
          </tr>
        </table>
    </fieldset>
    <p class="submit">
    <input type="submit" name="Submit" value="Update Options »" />
    </p>
    </form>
    <>
    <div class="wrap">
    <h2>Temp Opted-in users backup</h2>
      <p>Delete users from this panel once you have downloaded subscriptions with 
        your mailing list software. <br />
    </p>
    <?php
    if ($users = $wpdb->get_results("SELECT * FROM $table_users WHERE `msg_sent` = '1' ORDER BY `id` DESC")) {
    ?>
    <h3>Bcc friendly format:</h3>
    <p>
    <?php
    	$additional_user=0;
    	foreach ($users as $user) {
    		if ($user->msg_sent == "1") {
    			if ($additional_user) {
    				echo ', ';
    			}
    			$additional_user=1;
    			echo $user->email;
    		}
    	}	
    ?>
    </p>
    <?php
    }
    if ($users = $wpdb->get_results("SELECT * FROM $table_users ORDER BY `id` DESC")) {
    	$user_no=0;
    	//$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . basename(dirname(__FILE__)). '/' . basename(__FILE__);
    	$url = get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=' . $_GET['page'];
    ?>
    <table class="widefat">
    <thead>    
    <tr align="right"> 
          <td colspan="6">
        <script type="text/javascript"> 
    		//<![CDATA[
    		function confirm_purge (frm) {
    			if(frm.purge.selectedIndex != 0 && confirm('Are you sure you want to proceed?')) {
    				top.location.href='<?php echo $url; ?>&purge=' + frm.purge.options[frm.purge.selectedIndex].value;
    			}
    		}
    		//]]>
    	</script>
            <form method="get" action="">
    	  <fieldset class="options">Purge non opted-in users: 
              <select name="purge" id="purge">
                <option value="0">Select...</option>
                <option value="1">All</option>
                <option value="2">Older than 1 week</option>
                <option value="3">Older than 2 weeks</option>
                <option value="4">Older than 1 month</option>
              </select>
              <input type="button" name="prg_btn" id="prg_btn" value="Go" onclick="confirm_purge(this.form)" />
    	  </fieldset>
    	</form>
      </td>
    </tr>
    <tr>
    <th scope="col">ID</th>
    <th scope="col">Date/Time</th>
    <th scope="col">Opted-in</th>
    <th scope="col">IP</th>
    <th scope="col">E-mail</th>
    <th scope="col">Action</th>
    </tr>
    </thead>
    <tbody>
    <?php
    	$url = $url . '&user_id=';
    	foreach ($users as $user) {
    		if ($user_no&1) {
    			echo "<tr class=\"alternate\">";
    		} else {
    			echo "<tr>";
    		}
    		$user_no=$user_no+1;
    		echo "<td>$user->id</td>";
    		echo "<td>" . date(get_option('date_format'), $user->time). " " . date(get_option('time_format'), $user->time) . "</td>";
    		echo "<td>";
    		echo $user->msg_sent ? "Yes" : "No";
    		echo "</td>";
    		echo "<td>$user->ip</td>";
    		echo "<td>$user->email</td>";
    		echo "<td><a href=\"$url$user->id\" onclick=\"if(confirm('Are you sure you want to delete user with ID $user->id?')) return; else return false;\">Delete</a></td>";
    		echo "</tr>";
    	}
    ?>
    </tbody>
    </table>
    <p><em>ToolTip</em>: to insert the module in a page: 1) install the <a href="http://wordpress.org/extend/plugins/exec-php/">exec php</a> plugin; 2) insert this code in your pages: <?php wpsb_opt_in(); ?></p><>
    <?php
    }
    }
    
    
    function wpsb_widget_init() {
    global $wp_version;
    
    
    if (!function_exists('register_sidebar_widget')) {
    	return;
    }
    
    
    function wpsb_widget($args) {
    	extract($args);
    	echo $before_widget . $before_title;
    	echo get_option('wpsb_widget_title');
    	echo $after_title;
    	wpsb_opt_in();
    	echo $after_widget;
    }
    
    
    function wpsb_widget_control() {
    	$title = get_option('wpsb_widget_title');
    	if ($_POST['wpsb_submit']) {
    		$title = stripslashes($_POST['wpsb_widget_title']);
    		update_option('wpsb_widget_title', $title );
    	}
    	echo '<p>Title:<input  style="width: 200px;" type="text" value="';
    	echo $title . '" name="wpsb_widget_title" id="wpsb_widget_title" /></p>';
    	echo '<input type="hidden" id="wpsb_submit" name="wpsb_submit" value="1" />';
    }
    
    
    $width = 300;
    $height = 100;
    if ( '2.2' == $wp_version || (!function_exists( 'wp_register_sidebar_widget' ))) {
    	register_sidebar_widget('WP SendBlaster Opt-in', 'wpsb_widget');
    	register_widget_control('WP SendBlaster Opt-in', 'wpsb_widget_control', $width, $height);
    } else {
    	// v2.2.1+
    	$size = array('width' => $width, 'height' => $height);
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    	wp_register_sidebar_widget('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget', $class);
    	wp_register_widget_control('wpsb', 'WP SendBlaster Opt-in', 'wpsb_widget_control', $size);
    }
    if (function_exists('register_sidebar_module')) {
    	$class = array( 'classname' => 'wpsb_opt_in' ); // css classname
    	register_sidebar_module('WP SendBlaster Opt-in', 'wpsb_widget', '', $class);
    	register_sidebar_module_control('WP SendBlaster Opt-in', 'wpsb_widget_control');
    
    
    }
    }
    
    
    function wpsb_add_to_menu() {
    add_options_page('WP SendBlaster Opt-in Options', 'WP SendBlaster Opt-in', 7, __FILE__, 'wpsb_options' );
    }
    
    
    function wpsb_insert ($cnt) {
     global $wpsb_ob;
     $cnt = str_replace("<!--wpsb-opt-in-->", $wpsb_ob, $cnt);
     return $cnt;
    }
    
    
    
    
    register_activation_hook(__FILE__, 'wpsb_install');
    add_action('admin_menu', 'wpsb_add_to_menu');
    add_action('init', 'wpsb_widget_init');
    
    
    ?>
    

     

  6. I have a field in my table that gets populated with a custom value from a subscription form, but when the data gets inserted into the table, it adds some text I do not want to output. The field is for the user's name, but when the form saves it, it saves the name, plus the text #2# (this is from a Wordpress plugin and I can't figure out how to remove the #2# when I insert the value there either). Is there a way to remove this #2# text when I display the field's value in MySQL and PHP?

  7. I found a different code that sends the PDF, but when I try to open it, it says it may not have been decoded right. Can anyone help? Here is the code and the message. I also received this message when the page was processed:

     

     

    Warning[/size]: filesize() [[/size]function.filesize[/size]]: stat failed for http://www.webdesignsbyliz.com/blog/wp-content/themes/twentyten/eBook.pdf in[/size] [/size]/home/webdes17/public_html/blog/wp-content/themes/twentyten/sendEbook3.php[/size] [/size]on line[/size] [/size]20[/size][/size][/size]Warning[/size]: fread() [[/size]function.fread[/size]]: Length parameter must be greater than 0 in[/size] [/size]/home/webdes17/public_html/blog/wp-content/themes/twentyten/sendEbook3.php[/size] [/size]on line[/size] [/size]20

     

     

    
    <?php 
    
    
    $name = $_REQUEST['txtName'];
    $email = $_REQUEST['txtEmail'];
    
    
    $fileatt = "http://www.webdesignsbyliz.com/blog/wp-content/themes/twentyten/eBook.pdf"; // Path to the file 
    $fileatt_type = "application/pdf"; // File Type 
    $fileatt_name = "eBook.pdf"; // Filename that will be used for the file as the attachment 
    
    
    $email_from = "sales@mysite.com"; // Who the email is from 
    $email_subject = "Your attached file"; // The Subject of the email 
    $email_message = "Thanks for visiting mysite.com! Here is your free file.<br>";
    $email_message .= "Thanks for visiting.<br>"; // Message that the email has in it 
    
    
    $email_to = $email; // Who the email is to 
    
    
    $headers = "From: ".$email_from; 
    
    
    $file = fopen($fileatt,'rb'); 
    $data = fread($file,filesize($fileatt)); 
    fclose($file); 
    
    
    $semi_rand = md5(time()); 
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
    
    
    $headers .= "\nMIME-Version: 1.0\n" . 
    "Content-Type: multipart/mixed;\n" . 
    " boundary=\"{$mime_boundary}\""; 
    
    
    $email_message .= "This is a multi-part message in MIME format.\n\n" . 
    "--{$mime_boundary}\n" . 
    "Content-Type:text/html; charset=\"iso-8859-1\"\n" . 
    "Content-Transfer-Encoding: 7bit\n\n" . 
    $email_message .= "\n\n"; 
    
    
    $data = chunk_split(base64_encode($data)); 
    
    
    $email_message .= "--{$mime_boundary}\n" . 
    "Content-Type: {$fileatt_type};\n" . 
    " name=\"{$fileatt_name}\"\n" . 
    //"Content-Disposition: attachment;\n" . 
    //" filename=\"{$fileatt_name}\"\n" . 
    "Content-Transfer-Encoding: base64\n\n" . 
    $data .= "\n\n" . 
    "--{$mime_boundary}--\n"; 
    
    
    $ok = @mail($email_to, $email_subject, $email_message, $headers); 
    
    
    if($ok) { 
    echo "<font face=verdana size=2><center>You file has been sent<br> to the email address you specified.<br> 
    Make sure to check your junk mail!<br>
    Click <a href=\"#\" onclick=\"history.back();\">here</a> to return to mysite.com.</center>";
    
    
    } else { 
    die("Sorry but the email could not be sent. Please go back and try again!"); 
    } 
    ?> 
    

     

     

     

    [attachment deleted by admin]

  8. I have the following code, which is supposed to allow me to send files with e-mails, but it is only attached a MIME attachment and not the PDF I want to attach. Here is the code:

     

     

    
    <?php
    
    
    $name = $_REQUEST['txtName'];
    $email = $_REQUEST['txtEmail'];
    
      $to = "$email";
    
      $subject = "A test email";
    
      $random_hash = md5(date('r', time()));
    
      $headers = "From: noreply@geekology.co.za\r\nReply-To: noreply@geekology.co.za";
    
      $headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
    
      $attachment = chunk_split(base64_encode(file_get_contents("http://www.webdesignsbyliz.com/blog/wp-content/themes/twentyten/eBook.pdf")));
    
      $output = "
    --PHP-mixed-$random_hash;
    Content-Type: multipart/alternative; boundary='PHP-alt-$random_hash'
    --PHP-alt-$random_hash
    Content-Type: text/plain; charset='iso-8859-1'
    Content-Transfer-Encoding: 7bit
    
    Hello World!
    This is the simple text version of the email message.
    
    --PHP-alt-$random_hash
    Content-Type: text/html; charset='iso-8859-1'
    Content-Transfer-Encoding: 7bit
    
    <h2>Hello World!</h2>
    <p>This is the <b>HTML</b> version of the email message.</p>
    
    --PHP-alt-$random_hash--
    
    --PHP-mixed-$random_hash
    Content-Type: application/pdf; name=http://www.webdesignsbyliz.com/blog/wp-content/themes/twentyten/eBook.pdf
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment
    
    $attachment
    --PHP-mixed-$random_hash--";
    
      echo @mail($to, $subject, $output, $headers);
    
    ?>
    

     

     

    What am I doing wrong?

     

    [attachment deleted by admin]

  9.  

    I have a page with a page wrap that contains the page to only 800px, and I have a div below that that I want to repeat to be as tall as the content of the page. Right now I am setting a fixed height, but is there a way to set the height to fill to that height automatically, such as with a percentage or something? Here is my code so far: (I need the main-content div to repeat to the end of the left-col and right-col, if that makes sense)

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <style>
    * {
    margin: 0;
    padding: 0;
    }
    body {
    background: #000000;
    color: #FFFFFF;
    /*background: url(red_back2.png) #000000 top repeat-x;*/
    font-size: 62.5%;
    font-family: Helvetica, sans-serif;
    }
    ul#nav {
    height:504px;
    width:780px;
    background: url(images/main-img2.jpg) no-repeat;
    }
    img {
    border: none;
    }
    ul#nav li a {
    display: block;
    float: left;
    width: 73px;
    margin-left: 14px;
    }
    ul#nav li {
    list-style: none;
    }
    ul#boxes li {
    list-style: none;
    float: left;
    width: 150px;
    margin-left: 35px;
    margin-top: 0px;
    }
    div#logo {
    height: 71px;
    width: 324px;
    float: left;
    background: url(images/logo.jpg) no-repeat;
    }
    div#page-wrap {
    width: 800px;
    margin: 0 auto;
    }
    div#red_back {
    background: url(images/red_back.png) repeat-x;
    height: 269px;
    margin-top: -269px;
    margin-left: -27px;
    }
    div#red_boxes {
    height: 269px;
    margin-top: 163px;
    display: block;
    }
    #headline-img {
    height: 26px;
    margin-left: 600px;
    margin-top: -188px;
    }
    ul#boxes {
    margin-top: -205px;
    z-index: 2;
    position: absolute;
    width: 800px;
    margin-left: -15px;
    }
    ul#boxes li {
    margin-right: 10px;
    }
    ul#boxes li.box1 img.read1, ul#boxes li.box2 img.read2, ul#boxes li.box3 img.read3, ul#boxes li.box4 img.read4 {
    margin-top: 10px;
    margin-left: 70px;
    }
    div#main-content {
    background: url(main_back.png) repeat;
    height: 1000px;
    }
    div#left-col img.title_img {
    float: left;
    padding-right: 780px;
    padding-bottom: 25px;
    padding-top: 25px;
    }
    div#left-col {
    float: left;
    background: url(left-col_back.png) repeat;
    width: 780px;
    font-size: 1.5em;
    padding-bottom: 50px;
    }
    </style>
    </head>
    
    
    <body>
    <div id="page-wrap">
    <a href="index.html"><div id="logo"><></a>
    <ul id="nav">
    <li><a href="home.html"><img src="images/home_selected.png" alt="Home" /></a></li>
    <li><a href="about.html"><img src="images/about.png" alt="About" /></a></li>
    <li><a href="services.html"><img src="images/services.png" alt="Services" /></a></li>
    <li><a href="contact.html"><img src="images/contact.png" alt="Contact" /></a></li>
    </ul>
    <div id="headline-img"><a href="#"><img src="images/headline_img.jpg" alt="Learn More" /></a><>
    <div id="red_boxes"><img src="images/red_boxes2.png" alt="" />
    <ul id="boxes">
    <li class="box1"><p>Whether you live in an apartment, a residential home or a condominium, the possibility of water damage is very real. Even offices and commercial buildings are subject to water damage, especially damage due to faulty pipes, leakages or flooding. Water damage is indeed a very serious issue, especially if the water is contaminated with sewage or chemicals.</p><a href="water-damage.html#main"><img src="read_more1.jpg" class="read1" /></a></li>
    <li class="box2"><p>Have you recently been facing respiratory problems such as wheezing or difficulty breathing? Do your burning, watery eyes worry you? Have you found that skin irritation, pains and aches are becoming regular problems for you? If the answer to any of these questions is yes, then you should consider hiring a mold removal company to conduct a mold inspection. </p><a href="mold-remediation.html#main"><img src="read_more2.jpg" class="read2" /></a></li>
    <li class="box3"><p>Water damage cleanup must be undertaken immediately when floods, faulty pipes or water leaks afflict your home or office. Such water-related catastrophes can cause extensive damage to furnishings and flooring, particularly carpeting. The effects of unchecked water seeping through walls and floors and damaging furniture and upholstery can be devastating. </p><a href="water-damage-cleanup.html#main"><img src="read_more3.jpg" class="read3" /></a></li>
    <li class="box4"><p>Carpets are perhaps the most aesthetically important objects that you can add to your apartment. Carpets come in many varieties and a wide range of prices. Unfortunately, there are also many ways in which carpets can get stained. Usually, you treat these stains as soon as they turn up, or you leave it in the hands of professional cleaners.</p><a href="carpet-cleaning.html#main"><img src="read_more4.jpg" class="read4" /></a></li>
    </ul>
    <><!-- END RED_BOXES -->
    <div id="left-col">
    <img src="home_title.png" class="title_img" alt="Home" />
    <p>This is where the home page content will go.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus laoreet lectus ac elit vulputate ullamcorper. In mattis quam lorem. In nec nibh nec magna malesuada fringilla. Maecenas augue lacus, cursus id luctus id, dignissim vitae ipsum. Maecenas accumsan consequat ligula tempor cursus. Sed pellentesque mauris mi. Sed sit amet neque vel magna gravida auctor et a nunc. Duis quis diam enim. Curabitur vel ipsum elit. Donec porttitor ultrices tortor at dignissim. Vivamus accumsan est ut dui fringilla vestibulum. Quisque est magna, facilisis sit amet laoreet rutrum, facilisis luctus augue. Aenean lobortis varius aliquet. Ut ornare libero lobortis felis hendrerit adipiscing. Aenean urna quam, condimentum nec aliquam tincidunt, tincidunt at augue. Nullam hendrerit ullamcorper arcu elementum adipiscing. Duis accumsan, felis sed eleifend mollis, lacus purus eleifend velit, et sodales diam elit eu quam.
    </p>
    <p>Cras ultricies ipsum consequat nisi tristique congue. Suspendisse potenti. Proin laoreet tempor scelerisque. Nunc lacus nisi, malesuada sed sollicitudin sed, tincidunt a enim. Etiam eget lacus non libero consequat elementum. Quisque dui nibh, blandit quis congue quis, auctor sed metus. Sed non lacus tellus. Maecenas molestie lectus ac arcu ornare aliquet. Etiam tortor nisl, gravida et ullamcorper nec, auctor quis orci. Pellentesque nisi est, pellentesque vitae ultrices ut, facilisis at neque. Nulla consequat dui eget eros fringilla vitae sodales neque accumsan. Vestibulum hendrerit, purus ac facilisis ornare, lectus risus posuere odio, eu commodo nisl lacus vitae felis. Duis id magna tortor, vitae eleifend justo. Nunc pulvinar tincidunt consectetur. Fusce dictum, ante eget imperdiet adipiscing, erat ante sodales orci, non dignissim sem lorem sed lacus. Sed cursus augue et enim aliquet vehicula. Aenean auctor nulla ut sem ullamcorper aliquam. Fusce dui urna, ultrices a mollis at, porttitor eu dui. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
    </p>
    <p>Morbi mauris turpis, molestie ut rutrum non, pharetra ut mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dui turpis, scelerisque non malesuada non, vestibulum ac augue. Suspendisse tristique, massa ut dapibus ullamcorper, purus velit accumsan lectus, et ultrices augue libero at quam. Praesent nibh orci, facilisis ut gravida non, aliquet nec purus. Cras at risus massa. Maecenas bibendum fermentum leo vel rutrum. Etiam pulvinar sollicitudin leo, vel tincidunt massa dapibus sit amet. Nunc ultricies, augue pulvinar consequat scelerisque, leo turpis bibendum mi, eget dapibus neque nibh ut felis. In id blandit augue.
    </p>
    <p>Praesent euismod interdum orci mattis porttitor. Donec suscipit blandit nunc, eu ultricies augue viverra non. Praesent augue nulla, consectetur ac rhoncus vitae, vestibulum ac arcu. Vivamus sed cursus leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam et nulla at ante aliquet venenatis eget sit amet sem. Aliquam bibendum malesuada leo a semper. Proin consectetur velit dui, vitae fermentum tellus. Suspendisse tempor auctor accumsan. Mauris leo erat, vehicula in interdum in, suscipit vel sapien. Nullam adipiscing convallis sapien, eu dignissim augue scelerisque vel. Cras vitae tellus quis est faucibus ornare. Nunc metus est, pellentesque at bibendum at, malesuada non lectus. Ut sed lorem id orci interdum lobortis. Etiam ut tincidunt erat.
    </p>
    <p>Curabitur in placerat mi. Sed ut vehicula nibh. Suspendisse cursus tempus justo. Cras accumsan mi at diam condimentum vehicula. Maecenas eu ultrices purus. Proin vehicula facilisis leo sit amet dignissim. Cras quam mi, blandit et convallis ut, auctor sed dui. Donec eget nisi tortor. Donec adipiscing felis ligula. Vivamus ut ante dui, nec tristique urna. Nullam sagittis tincidunt venenatis. Proin sed sapien sit amet ante auctor bibendum. Vestibulum lacus arcu, ultricies vitae placerat in, ultrices non purus. Vestibulum tincidunt nisl id est tincidunt ac adipiscing dui ullamcorper. Sed placerat massa at nisi cursus in dapibus velit ultricies. Vestibulum sed nisi id dolor rutrum tempor eu quis ante. Aenean sit amet elit quis nisi consectetur laoreet.</p>
    <><!-- END LEFT-COL -->
    <div id="right-col">
    
    
    <><!-- END RIGHT-COL -->
    <><!-- END PAGE-WRAP-->
    <div id="red_back"><>
    <div id="main-content">
    
    
    <><!-- END MAIN-CONTENT -->
    </body>
    </html>
    

     

     

    Can anyone help?

  10. I have a site that works fine in Safari, but in in 6 one element is not displaying in the back the way I want it to. It is supposed to go behind the four boxes in the middle (it's just a big orange/red bar that is supposed to repeat across the page in the back), but instead it is displaying in front and not repeating all the way across the page. Here is the link:

     

     

    http://www.webdesignsbyliz.com/a1/new

     

     

    Can anyone help me out and tell me how to fix this issue?

  11. I have a form in WordPress (using Contact Form 7), and form some reason it look fine in Safari, but the CAPTCHA and textbox for the CAPTCHA won't stay at the bottom in FireFox like I want them to. Instead they are appearing at the top of the form. Here is a screen shot attached. Can anyone tell me how to fix it? Also attached is the way I want it to look. Please tell me if you need to see my CSS or if you can diagnose just by looking. I do not think I have any CSS set to these two elements, except for he textbox's height. How do I fix it?

     

    [attachment deleted by admin]

  12. I need some help getting my validation working. I have the following form:

     

     

    
    <form name="contact_form" id="contact_form" method="post" action="http://www.batyathebabycoach.com/wp-content/themes/twentyten/send_message.php">
      <div class="s3">
      <table width="589" border="0" cellspacing="0" cellpadding="0">
      
    <tr>
    <td>Name :</td>
    <td> Email :</td>
    </tr>
    
    
    <tr>
    <td><input type="text" id="txtName" name="txtName" value="<?php echo $name; ?>" tabindex="1" /> </td>
    <td><input type="text" id="txtEmail" name="txtEmail" value="<?php echo $email; ?>" tabindex="2" /> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td>Location(city/country) :</td>
    <td> Phone :</td>
    </tr>
    <tr>
    <td><input type="text" id="txtLocation" name="txtLocation" value="<?php echo $location; ?>" tabindex="3" /></td>
    <td><input type="text" id="txtPhone" name="txtPhone" value="<?php echo $phone; ?>" tabindex="4" /> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td>Age of Baby :</td>
    <td>How did you hear about me? :</td>
    </tr>
    <tr>
    <td><input type="text" id="txtAge" name="txtAge" value="<?php echo $age; ?>" tabindex="5" /> </td>
    <td><input type="text" id="txtAbout" name="txtAbout" value="<?php echo $about; ?>" tabindex="6" /> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    </tr>
    <tr><td colspan="2">Brief Explanation of Baby’s issues :</td></tr>
    <tr><td colspan="2"><textarea cols="41" rows="6" id="txtIssues" name="txtIssues" value="<?php echo $issues; ?>" tabindex="7"></textarea></td></tr>
    
    
    <tr>
    <td> </td>
    </tr>
    
    
    <tr><td colspan="2">Other comments :</td></tr>
    <tr>
    <td colspan="2"><textarea cols="65" rows="6" id="txtComments" name="txtComments" value="<?php echo $comments; ?>" tabindex="8"></textarea> </td></tr>
    <tr><td><br/> </td></tr>
    <tr><td colspan="2">Enter the Captcha Code :</td></tr>
    <tr>
    <td colspan="2" ><!--captcha will go here -->  <input type="text" name="txtCaptcha" id="txtCaptcha" value="<?php echo $captcha; ?>" tabindex="9"</td></tr>
    <tr>
    <td> </td>
    </tr>
    <tr><td colspan="2"><input type="submit" id="submit" name="submit" value="Submit" tabindex="10" /> <input type="reset" id-"reset" name="reset" value="Reset" tabindex="11" /></td></tr>
    
    
    </table>
    <>
    </form>
    

     

     

    And I have added this validation to the header, right above the wp_header, as you can see here:

     

     

    
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jquery.validate.js"></script>
    
    
    <script type="text/javascript">
    //initiate validator on load
    $(function() {
    // validate contact form on keyup and submit
    $("#contact_form").validate({
    //set the rules for the field names
    rules: {
    txtName: {
    required: true,
    minlength: 2
    },
    txtEmail: {
    required: true,
    email: true
    },
    txtLocation: {
    required: true,
    minlength: 2
    },
    txtPhone: {
    required: true,
    
    
    },
    txtAge: {
    required: true,
    
    
    },
    txtAbout: {
    required: true,
    minlength: 2
    },
    txtIssues: {
    required: true,
    minlength: 2
    },
    txtCaptcha: {
    required: true,
    minlength: 4
    },
    },
    //set messages to appear inline
    messages: {
    txtName: "Please enter your name",
    txtEmail: "Please enter a valid email address",
    txtLocation: "Please enter your City/Country",
    txtPhone: "Please enter a valid phone number",
    txtAge: "Please enter your child's age",
    txtAbout: "Please enter how you heard about me",
    txtIssues: "Please enter your baby's issues",
    txtCaptcha: "Please enter the letters you see in the image"
    }
    });
    });
    </script>
    <!-- END JS FOR CONTACT FORM VALIDATION -->
    <?php
    /* We add some JavaScript to pages with the comment form
     * to support sites with threaded comments (when in use).
     */
    if ( is_singular() && get_option( 'thread_comments' ) )
    	wp_enqueue_script( 'comment-reply' );
    
    
    /* Always have wp_head() just before the closing </head>
     * tag of your theme, or you will break many plugins, which
     * generally use this hook to add elements to <head> such
     * as styles, scripts, and meta tags.
     */
    wp_head();
    ?>
    </head>
    

     

     

    And I have both files in a folder named js at this address: http://websitenamehere.com/wp-content/themes/twentyten/js

    [/size]

    [/size]Can anyone tell me what I'm doing wrong and how to fix this? I have looked at several other tutorials and they seemed basically the same, but did not work either. What am I doing wrong?

  13. Can you help me get this started? I am new to JavaScript and am having a hard time setting the code up correctly. I tried setting the var url to the value of the url I wanted to use, and also setting the value of the textbox to the url I wanted to use, but I do not know how to set toe code to run the script as it loads instead of when the user presses enter on the textbox. Should i set it to the textbox and make it invisible or is there a better way? Can you please help?

  14. I mean, in the JavaScript, it has a var named url that gets set by whatever the user puts in the textbox, and when the user presses enter or return, the page of the url is displayed. I want to know if there is a way to set this JavaScript up to instead of waiting for the user to type in a url in the textbox, if we could eliminate the textbox and set the value of the variable to a specific url instead? Did that make any more sense?

  15. Is there a way to set this javascript code to a constant url rather than allowing a user to type in the url address?

     

     

    
    <html>
    <head> 
    <title></title>
    <script type="text/javascript"> 
    	var Drag = {};
    	var gui;
    	var cut;
    	var outer;
    	var IE;
    	var url;
    	var site;
    	var exp;
    	var fade;
    	var m={x:0,y:0};
    	var pan=false;
    	var mouseDown=false;
    	var jailbreak;
    	function init() {
    		IE = document.all?true:false;
    		if (!IE) document.captureEvents(Event.MOUSEMOVE);
    		document.onmousemove = getMouseXY;
    		gui = document.getElementById('gui');
    		cut = document.getElementById('cut');
    		outer = document.getElementById('outer');
    		url = document.getElementById('url');
    		site = document.getElementById('site');
    		exp = document.getElementById('export');
    		fade = document.getElementById('fade');
    		url.focus();
    		gui.onmousedown = function () {
    			url.focus();
    			mouseDown = true;
    			exp.style.display = '';
    			exp.onmouseup = gui.onmouseup = function () {
    				mouseDown = false;
    				url.value = url.value.split(' ').join('');
    				gui.onmousemove = null;
    			}
    			var tmpX = m.x;
    			var tmpY = m.y;
    			var tmpSiteY = parseInt(site.style.top);
    			var tmpSiteX = parseInt(site.style.left);
    			if(!pan) {
    				outer.style.top = tmpY+"px";
    				outer.style.left = tmpX+"px";
    				cut.style.top = -tmpY+parseInt(site.style.top)+"px";
    				cut.style.left = -tmpX+parseInt(site.style.left)+"px";
    				cut.style.width = site.offsetWidth+"px";
    				cut.style.height = site.offsetHeight+"px";
    			}
    			gui.onmousemove = function () {
    				if(pan && mouseDown) { 
    					site.style.top = tmpSiteY+(m.y-tmpY)+"px";
    					site.style.left = tmpSiteX+(m.x-tmpX)+"px"; 
    					cut.style.top = tmpSiteY+m.y-tmpY-parseInt(outer.style.top)+"px";
    					cut.style.left = tmpSiteX+m.x-tmpX-parseInt(outer.style.left)+"px";
    				} else {
    					if(m.y-tmpY<0) { 
    						outer.style.top = m.y+"px";
    						outer.style.height = (tmpY-m.y)+"px";
    						outer.style.minHeight = (tmpY-m.y)+"px";
    						cut.style.top = -m.y+parseInt(site.style.top)+"px";
    					} else {
    						outer.style.height = (m.y-tmpY)+"px";
    						outer.style.minHeight = (m.y-tmpY)+"px";
    					}
    
    					if(m.x-tmpX<0) {
    						outer.style.left = m.x+"px";
    						outer.style.width = (tmpX-m.x)+"px";
    						cut.style.left = -m.x+parseInt(site.style.left)+"px";
    					} else {
    						outer.style.width = (m.x-tmpX)+"px";
    					}
    					exp.style.top = parseInt(outer.style.top)+parseInt(outer.style.height)+"px";
    					exp.style.left = parseInt(outer.style.left)+parseInt(outer.style.width)-50+"px"; 
    
    				return false;
    				}
    				var wSize = window.size();
    				cut.style.minHeight = site.style.minHeight = site.style.height = cut.style.height = wSize.height+Math.abs(parseInt(site.style.top))+"px";
    				site.style.width = cut.style.width = wSize.width+Math.abs(parseInt(site.style.left))+"px";
    				return false;	
    			}
    			return false;
    		}
    		return false;
    	}
    
    	getMouseXY = function (e) {
    		if (IE) {
    			m.x = event.clientX + document.body.scrollLeft;
    			m.y = event.clientY + document.body.scrollTop;
    		} else {
        			m.x = e.pageX;
        			m.y = e.pageY;
      			}
      			if (m.x<0) m.x=0;
      			if (m.y<0) m.y=0;
      			return true;
    	}
    
    	window.size = function() {
    		var w = 0;
    		var h = 0;
    		if(!window.innerWidth) {
    			if(!(document.documentElement.clientWidth == 0)) {
    				w = document.documentElement.clientWidth;
    				h = document.documentElement.clientHeight;
    			} else {
    				w = document.body.clientWidth;
    				h = document.body.clientHeight;
    			}
    		} else {
    			w = window.innerWidth;
    			h = window.innerHeight;
    		}
    	return {width:w,height:h};
    	}
    
    	Drag.start = function () {
    	var elem = document.getElementById('urlbox');
    		var dX = m.x-parseInt(elem.style.left);
    		var dY = m.y-parseInt(elem.style.top);
    		document.body.onmouseup = function () {
    			Drag.stop(this);
    		}
    		document.body.onmousemove = function () {
    			elem.style.left = m.x-dX+"px";
    			elem.style.top = m.y-dY+"px";
    		}
    	}
    	Drag.stop = function (elem) {
    		elem.onmousemove = null;
    	}
    
    	changeurl = function (e) {
    		var keyCode;
    		if(window.event) {
      				keyCode = e.keyCode;
      			} else if(e.which) {
    			keyCode = e.which;
    		}
    		if(32==keyCode) {
    			url.value = url.value.split(' ').join('');
    		} else if(13==keyCode) {
    			cut.src = url.value;
    			site.src = url.value;
    			return false;
    		}
    	return true;
    	}
    
    	dopan = function (e) {
    		var keyCode;
    		if(window.event) {
      				keyCode = e.keyCode;
      			} else if(e.which) {
    			keyCode = e.which;
    		}
    		if(32==keyCode) {
    			pan=true;
    			document.body.style.cursor='move';
    		}
    	return true;
    	}
    
    	stoppan = function (e) {
    		pan=false;
    		document.body.style.cursor='default';
    	return true;
    	}
    
    	defaultdisabled = function (e) {
    	if (!e)
    		event.returnValue = false;
    	else
    		e.preventDefault();
    		return false;
    	}
    
    	genIframe = function () {
    		var normalCode = "<div style=\"overflow: hidden; width: "+outer.style.width+"; height: "+outer.style.height+"; position: relative;\" id=\"i_div\">\n<iframe name=\"i_frame\" src=\""+url.value+"\" style=\"border: 0pt none ; left: "+cut.style.left+"; top: "+cut.style.top+"; position: absolute; width: "+cut.style.width+"; height: "+cut.style.height+";\" scrolling=\"no\"><\/iframe><\>";
    			if(navigator.userAgent.indexOf("Firefox") != -1) {
       					var win = window.open('');
    				var doc = win.document;
    				doc.open("text/html", "replace");
    					var normalDisplay = "<h1>Copy & Paste</h1><textarea style=\"width:400px;height:200px;\">"+normalCode+"</textarea>";
    				doc.write(normalDisplay);
    				doc.close();
       				} else {
    				var example = window.open();
    				if(example) {
    					var doc = example.contentDocument?example.contentDocument:example.document;					
    					var normalDisplay = doc.createElement('textarea');
    					normalDisplay.innerText = normalCode;
    					normalDisplay.style.width = "400px";
    					normalDisplay.style.height = "200px";
    					var h2 = doc.createElement('h1');
    					h2.innerText = 'Copy & Paste;';
    					doc.body.appendChild(h2);
    					doc.body.appendChild(normalDisplay);
    					example.focus();
    				}
    			}
    		return true;
    	}
    </script> 
    <style type="text/css"> 
    * {margin:0px; padding:0px;font-size:12px;font-family: sans-serif;}
    body, div { height:100%;}
    #outer {
    position:absolute;
    left:0px;
    top: 0px;
    width:250px;
    height:250px;
    overflow:hidden;
    }
    
    a {
    color: #3d6d91;
    text-decoration: none;
    }
    
    .black_overlay{
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-color: black;
    -moz-opacity: 0.8;
    opacity:.80;
    filter: alpha(opacity=80);
    }
    .ui_overlay{
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index:1001;
    -moz-opacity: 0.0;
    opacity:.00;
    filter: alpha(opacity=00);
    }
    </style> 
    </head> 
    <body style="width:100%;height:100%;overflow:hidden;" onload="init();" ondragstart="return false" onkeydown="return dopan(event);" onkeyup="return stoppan(event);"> 
    <iframe id="site" src="http://www.blackhatworld.com" style="width:100%;min-height:100%;height:100%;position:absolute;top:0px;left:0px;z-index:0;border:none;background:#fff;" scrolling="no" onmousedown="return defaultdisabled(event);"></iframe> 
    <div id="fade" class="black_overlay" style="z-index:1;" onmousedown="return defaultdisabled(event);"><> 
    <div id="outer" style="width:100%;height:100%;position:absolute;top:0px;left:0px;z-index:2;border:none;" onmousedown="return defaultdisabled(event);"> 
    <iframe id="cut" src="http://www.blackhatworld.com" style="width:100%;min-height:100%;height:100%;position:absolute;top:0px;left:0px;border:none;background:#fff;" scrolling="no" onmousedown="return defaultdisabled(event);"></iframe><> 
    <div id="gui" class="ui_overlay" style="z-index:3;" onmousedown="return defaultdisabled(event);"><> 
    <div id="urlbox" style="z-index:4;min-height:20px;height:20px;line-height:20px;border:0px;position:absolute;top:0px;left:0px;"><img style="display:block;float:left" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABFdJREFUeNp0VM1PXFUU/9377nvz3nwwMCjy1Vpg7BBFxEApqF3YyKZNF9Wd0USjLkyMbvsPuHLlxoULN+1Comki6qLVavxIqUgaihFpYWillCIw38PM+7zXMzMFWmPv5OS+N/e+3zm/8zvnIPCyCLw8lHJQnPoSK4cOY214HG26DlrjZCO1B8YY3nzjNVSrJShZpm+KCNxtBH6BLAevsEUYCgL3rdofkqxZAaejTT0Ltr05BJ4OXnwe73/8EVLJw3RLgwwqeNh6AJBxBuX5EXlkbPLD5BNHt2amb4UrlTMtJ05diiUHoIICwK2a690Q9nf6tg7IQCBER8GGOTYCkex5hbUkTup0rrj2yAbXP2sdSL0KyAKY1sYY7wITm4qIM24+zrjhUygqqBZXEMUvNf5Jz82/JwP7C6I8m/nu4upsalDNd/Wq31oeU98+Pajs0iYdqUD9Z0lfKvtuQZUXbqncN5eWayljTn7rExY239U0E8VcGiLWhOyvc7g9eR6iswttLx1D99godC22lxo/b8Nd+wfe5h34Ig+rNwSjla0I63ifcObWdevZXrAmDdH4Abh2AW3HRtF+/Bh47ac0SokGd6MEZ+kOJCtTrrPQ2z1ERgwoKwIEnFjLRg6d2RVpL61DH+xEfPhJhKMd+6rvBPDyFdjpRfilZRjtEuZBC6I5TIcmZZEccg1MJ2DPbQBqhlD+agb5r67AmyDKHa0IJbvhF4qwKzcgw2VE+gTCcReaiJI2nMqLgRshCorBXV7HzvfXUP35D9b9+QsQ8mYGqlqFYYWgNnKo/Hgd/qFOeC8XoA1WqBqawMwEpL8BSjO4LuCvZlGeuYry1O+w55YhdRI6bjQiVI4v4UkKW4cquzAScWj07ERcKDcgR7Tr1A05G870AipTC7Bn0vDdKliHBfYUiZWhQl+3G4DcMutFKV0PKueAJ5rBDEEgJIaScGZvonQhDffyGmS5Ct5pQktFwDJUu3eJwZZEeLgfsQ+eu9cpnJOIlFhBVk+woPrlsD8lOvOUw40yeGsIoo+E2CaQogO1mUd4KIno22Mwj6Rg9HbWu3239dReB9Xah1EJ+NTTi+tAWELri9UjD+ZyCPd3IHqyH9GJIYQGkuTYrLNQkhSWqo4m9npxF7TmRyMVa+/pEvijcVjjvYiffgaRoR6IaAvVHU0i5ROQDZlVCFZdeH86PPZ6DZBcKNUAZbuIpBNPdSDyVj/CowdgJmLQeYgY0C2PKFcJc82Hd20H/g0SrahKlLKLu5T5/rhhjWgph+Kdo2AJp46vfIqGCQS3Fdy/PPjXScA8I2TtB26KcyyKC/RhpgGocIX2U2QH94HJJLVSQJbVIZcseH9bUNs0WaQ2ywx+lqYYRcSW79Han4ekyDmKYYWim6T37sYFhdBiDHy7CWLNBAuMeRj8PLfY13R2Fer+Wfj/A/YyeRsh0DO0TxC/dnO+JUfPP8HEWXIyTbl2HxDvIetfAQYAoOUIbSv9JcAAAAAASUVORK5CYII=" onmousedown="Drag.start();return defaultdisabled(event);"/><input type="text" id="url" style="float:left;min-height:20px;height:20px;width:175px;" value="http://url.here" onkeydown="return changeurl(event);"></input><> 
    <div id="export" style="z-index:5;position:absolute;top:0px;left:0px;display:none;"><input type="button" value="Export" style="min-height:20px;height:20px;width:50px;" onclick="genIframe();"></input><> 
    </body> </html>
    

    It must be possible?

  16. Is there a way to get around an iframe displaying in Internet Explorer without forcing users to set their security settings to low? It works fine in every other browser but Internet Explorer. There must be a way around this?

  17. I am trying to add a rollover feature to a rotating banner, but I cannot figure out how to do it. I have tried adding the on rollover thing and the over state on the actual button, but I am not having any luck. Can anyone help? I'm sure it is very simple, but I just cannot get it figured out! It will not let me attach the file, but if you can help, I will send you my file, unless you know another way? Please, can anyone help?!?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.