How do I add my autoresponder code to a prebuilt form on a squeeze page template?

10 replies
  • WEB DESIGN
  • |
I am currently using MailChimp and I need to find out where to place the code in the squeeze page template that I want to use in order to make it work right.

Here's the code that is on the squeeze page and that I want to use...

<!--autoresponder code *begin*-->
<form> <input name="name" class="field_name"
onfocus="if(this.value == '*Enter Your First Name'){ this.value = ''; this.style.color= '#1a1a1a'; }"
onblur="if(this.value == ''){ this.value = '*Enter Your First Name'; this.style.color= '#818181';}"
value="*Enter Your First Name" type="text" /> <input name="email"
class="field_email"
onfocus="if(this.value == '*Enter Your Email Address'){ this.value = ''; this.style.color= '#1a1a1a'; }"
onblur="if(this.value == ''){ this.value = '*Enter Your Email Address'; this.style.color= '#818181'; }"
value="*Enter Your Email Address" type="text" /> <input name="Submit"
class="submit" value="Submit" type="submit" /> </form>
<!--autoresponder code *end*-->

Here's the code that I got from Mail Chimp. How do I make it work with the form on the template i want to use.

<div id="mc_embed_signup">
<form action="http://extremenewbiemarketing.us6.list-manage1.com/subscribe/post?u=61d9d35e0f33cd495a1f0c107&amp;id=1cc0c79413"
method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group">
<label for="mce-FNAME">First Name <span class="asterisk">*</span>
</label>
<input type="text" value="" name="FNAME" class="required" id="mce-FNAME">
</div><div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span>
</label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"
class="button"></div>
</form>
</div>
<!--End mc_embed_signup-->


All I want is that when they click on the button on my squeeze page, I get their email address and they get the free product that I'm offering.

I dont see the page that has the download link for the product either. Where is it suppose to go in the code.

Any help would be appreciated.
#add #autoresponder #code #form #page #prebuilt #squeeze #template
  • Profile picture of the author Steve Wells
    Go Here!

    Here!

    And login with the information I am PM'ing you.

    Go to Training Tab, and watch the video titled "How To Integrate Opt-in Code Into Video Squeeze Page"

    Steve
    Signature
    Need Custom Graphics Work? - Message Me For A Design Quote!
    {{ DiscussionBoard.errors[7380977].message }}
  • Profile picture of the author John Keane
    Hello texasmom64,

    Here's your working code:
    Code:
    <!--autoresponder code *begin*-->
    <form action="http://extremenewbiemarketing.us6.list-manage1.com/subscribe/post?u=61d9d35e0f33cd495a1f0c107&amp;id=1cc0c79413" 
    method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> 
    <div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
    <div class="mc-field-group">
    <label for="mce-FNAME">First Name <span class="asterisk">*</span>
    </label> 
    <input type="text" value="Enter Your First Name" name="FNAME" class="required" id="mce-FNAME" onfocus="if(this.value == '*Enter Your First Name'){ this.value = ''; this.style.color= '#1a1a1a'; }" onblur="if(this.value == ''){ this.value = '*Enter Your First Name'; this.style.color= '#818181';}" />
    </div><div class="mc-field-group"> 
    <label for="mce-EMAIL">Email Address <span class="asterisk">*</span>
    </label>
    <input type="email" value="Enter Your Email Address" name="EMAIL" class="required email" id="mce-EMAIL" onfocus="if(this.value == '*Enter Your Email Address'){ this.value = ''; this.style.color= '#1a1a1a'; }"
    onblur="if(this.value == ''){ this.value = '*Enter Your Email Address'; this.style.color= '#818181'; }" />
    </div>
    <div id="mce-responses" class="clear">
    <div class="response" id="mce-error-response" style="display:none"></div>
    <div class="response" id="mce-success-response" style="display:none"></div>
    </div> 
    <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" 
    class="button"></div>
    </form>
    <!--autoresponder code *end*-->
    If you have any question, simply PM me a message

    Best Regards,
    John Keane
    {{ DiscussionBoard.errors[7381272].message }}
    • Profile picture of the author texasmom64
      Thank you both for helping me out. I appreciate it so very much.

      Happy Holidays
      texasmom
      Signature

      Are You Desperately Trying To Earn An Income Online, But No Matter How Hard You Try, It Just Ain't Happening?

      Extreme Newbie Income Can Help!

      {{ DiscussionBoard.errors[7381807].message }}
  • Profile picture of the author zoldusta
    you need to locate 3 things in your index file to integrate your autoresponder account

    action url
    campaign name
    redirect url

    go to your auto responder account campaign and find these things and go back to your index file in your squeeze templates and replace them. that's all.

    but in any way all squeeze pages come with instructions on how to integrate using the most popular autoresponders, aweber, getresponse, imnicamail...etc.
    {{ DiscussionBoard.errors[7382159].message }}
  • Profile picture of the author John Keane
    Hey texasmom64,

    I replied to your PM..

    Let me know what struggles you in inserting the optin code from your mail chimp.
    Do you want unique button Image for Submit Button?

    I'm really happy to help everyone here

    Cheers,
    John Keane
    {{ DiscussionBoard.errors[7382228].message }}
  • Profile picture of the author MusicMinCoach
    Wow, I was just struggling with this last night! The trouble is that many templates come with these great-looking graphics built in for the opt-in form. Only some of them don't really explain how to integrate your own opt-in form and still keep the styling of the template.

    I ended up completely replacing the styling with my own form last night. So if you guys wouldn't mind I'd love to get that information too please. Thanks for posting this one Texmom!
    {{ DiscussionBoard.errors[7382249].message }}
  • Profile picture of the author John Keane
    MusicMinCoach,

    Let me know what struggles you with the opt in codes.

    I helped bunch of peoples that has the same issue with texasmom..

    Hit me a PM and I will sure to help

    Regards,
    John Keane
    {{ DiscussionBoard.errors[7382280].message }}
  • Profile picture of the author Rich Roberts
    Thank you guys because I was also have some difficulties with this as well.
    {{ DiscussionBoard.errors[8505338].message }}
    • Profile picture of the author skillmyman
      good evening all. Am very new to this forum. I have same challenge. I bought a plr product and I want to integrate it to my aweber autoresponder. I have gone to fiverr , paid twice and they have not been able to resolve this issue for me.

      I have also gone to you tube and tried the various advices but when I test, it says name and email missing.

      I will actually appreciate a solution here.

      the code for the squeeze page is this below:

      <HTML>
      <HEAD>
      <TITLE>sliced</TITLE>
      <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
      </HEAD>
      <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
      <!-- ImageReady Slices (sliced.psd) -->
      <TABLE WIDTH=800 BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
      <TR>

      <TD COLSPAN=2 ROWSPAN=3> <IMG SRC="images/squeeze-org1_01.jpg" WIDTH=213 HEIGHT=188 ALT=""></TD>

      <TD COLSPAN=5 background="images/squeeze-org_02.jpg" height="52" valign="top">
      <div align="left"><font face="Arial, Helvetica, sans-serif" size="4"><i><font size="3"><b><br>
      FREE Report...</b></font></i></font></div>
      </TD>
      </TR>
      <TR>

      <TD COLSPAN=5> <IMG SRC="images/squeeze-org1_03.jpg" WIDTH=587 HEIGHT=22 ALT=""></TD>
      </TR>
      <TR>

      <TD background="images/squeeze-org1_04.jpg" height="114" valign="bottom">
      <div align="center">
      <p align="center"><b><font face="Arial, Helvetica, sans-serif" color="#330099" size="5">&quot;Discover
      Two Commonly-Known Foods With </font><font face="Arial, Helvetica, sans-serif" size="5">Sex-Boosting</font><font face="Arial, Helvetica, sans-serif" color="#330099" size="5">
      Power!&quot;</font></b></p>
      </div>
      </TD>

      <TD COLSPAN=4> <IMG SRC="images/squeeze-org1_05.jpg" WIDTH=233 HEIGHT=114 ALT=""></TD>
      </TR>
      <TR>
      <TD ROWSPAN=7>
      <IMG SRC="images/squeeze-org_06.jpg" WIDTH=69 HEIGHT=432 ALT=""></TD>

      <TD COLSPAN=2 ROWSPAN=8 background="images/squeeze-org1_07.jpg" height="474" valign="top">
      <p>&nbsp;</p>
      <p><font face="Arial, Helvetica, sans-serif">Inside your FREE copy of &quot;<b>Two
      Commonly-Known Foods With Sex-Boosting Power</b>&quot; you'll find... </font></p>
      <ul>
      <li><font face="Arial, Helvetica, sans-serif">How just one or two spoonfuls
      of this substance can give you the energy and explosive power to <u>last
      all night long</u> </font></li>
      </ul>
      <ul>
      <li><font face="Arial, Helvetica, sans-serif">Add this delicious food
      to almost any meal or snack, and <i>quickly</i> increase your intake
      of <u>powerful nutrients</u> that help get both your body and your brain
      <b>ready</b> for a wild, passionate night </font></li>
      </ul>
      <ul>
      <li><font face="Arial, Helvetica, sans-serif"><u>Warning</u>: This substance,
      while commonly used before sexual activity, can in fact <b>decrease</b>
      libido, endurance, and even cause temporary <i>impotence</i></font></li>
      </ul>
      <p><font face="Arial, Helvetica, sans-serif">Getting a copy of the FREE
      report <b>Two Commonly-Known Foods With Sex-Boosting Power</b> is easy.
      Just sign up for <b><font color="#FF3399">The XYZ newsletter</font></b>
      today and then access it via the online confirmation page where you can
      download it immediately, <b>absolutely free</b>. </font> </p>
      </TD>

      <TD ROWSPAN=7> <IMG SRC="images/squeeze-org1_08.jpg" WIDTH=33 HEIGHT=432 ALT=""></TD>

      <TD COLSPAN=2 background="images/squeeze-org_09.jpg" height="217" valign="top">
      <div align="center">
      <p><br>
      <font face="Arial, Helvetica, sans-serif"><b>Get this SPECIAL REPORT
      with Your FREE Subscription to <font color="#FF3399">The XYZ newsletter</font>:
      </b></font></p>
      <p><b><font face="Arial, Helvetica, sans-serif" color="#FF0800">Two Commonly-Known
      Foods With Sex-Boosting Power!</font></b></p>
      </div>
      </TD>
      <TD ROWSPAN=7>
      <IMG SRC="images/squeeze-org_10.jpg" WIDTH=26 HEIGHT=432 ALT=""></TD>
      </TR>
      <TR>
      <TD COLSPAN=2>
      <IMG SRC="images/squeeze-org_11.jpg" WIDTH=174 HEIGHT=71 ALT=""></TD>
      </TR>
      <TR>
      <form method="post" action="Email Newsletter AWeber Form">
      <input type="hidden" name="meta_web_form_id" value="0123456789">
      <input type="hidden" name="meta_split_id" value="">
      <input type="hidden" name="unit" value="YourListName">
      <input type="hidden" name="redirect" value="Thank You">
      <input type="hidden" name="meta_adtracking" value="">
      <input type="hidden" name="meta_message" value="1">
      <input type="hidden" name="meta_required" value="from,name">
      <input type="hidden" name="meta_forward_vars" value="0">
      <TD COLSPAN=2>
      <IMG SRC="images/squeeze-org_12.jpg" WIDTH=174 HEIGHT=25 ALT=""></TD>
      </form></TR>
      <TR>

      <TD ROWSPAN=4> <IMG SRC="images/squeeze-org1_13.jpg" WIDTH=9 HEIGHT=119 ALT=""></TD>

      <TD background="images/squeeze-org_14.jpg" height="30">
      <div align="center">
      <input style="font-family: Arial,Verdana,Tahoma; font-size: 10px; color: #151506; font-weight: normal; height: 19px; width: 145px; background-color: #ffffff" type="TEXT" name="name" size="5">
      </div>
      </TD>
      </TR>
      <TR>
      <TD>
      <IMG SRC="images/squeeze-org_15.jpg" WIDTH=165 HEIGHT=18 ALT=""></TD>
      </TR>
      <TR>

      <TD background="images/squeeze-org_16.jpg" height="32">
      <div align="center">
      <input style="font-family: Arial,Verdana,Tahoma; font-size: 10px; color: #151506; font-weight: normal; height: 19px; width: 145px; background-color: #ffffff" type="TEXT" name="from" size="5">
      </div>
      </TD>
      </TR>
      <TR>

      <TD> <a href="#" onmouseover="window.status='Subscribe Now!'; return true;" onmouseout="window.status=''; return true;" onclick="check_link=0; window.document.forms[0].submit();"><IMG SRC="images/squeeze-org1_17.jpg" border="0" alt="Subscribe Now!" width="165" height="39"></a></TD>
      </TR>

      <TR>
      <TD>
      <IMG SRC="images/squeeze-org_18.jpg" WIDTH=69 HEIGHT=42 ALT=""></TD>

      <TD> <IMG SRC="images/squeeze-org1_19.jpg" WIDTH=33 HEIGHT=42 ALT=""></TD>

      <TD COLSPAN=3> <IMG SRC="images/squeeze-org1_20.jpg" WIDTH=200 HEIGHT=42 ALT=""></TD>
      </TR>
      <TR>
      <TD ROWSPAN=2>
      <IMG SRC="images/squeeze-org_21.jpg" WIDTH=69 HEIGHT=130 ALT=""></TD>

      <TD COLSPAN=3 background="images/squeeze-org1_22.jpg" height="58" valign="bottom">
      <div align="center">
      <p><font face="MS Sans Serif"><a href="terms"><font size="2">Terms</font></a><font size="2">
      | <a href="privacy">Privacy</a> | <a href="disclaimer">Disclaimer</a>
      | <a href="contact">Contact</a><br>
      Copyright 2007 YourNameHere.&nbsp; All Rights Reserved.</font></font></p>
      </div>
      </TD>

      <TD COLSPAN=3 ROWSPAN=2> <img src="images/squeeze-org1_23.jpg" width=200 height=130 alt=""></TD>
      </TR>
      <TR>

      <TD COLSPAN=3 height="72" bgcolor="#EFEFFF" background="images/squeeze-org1_24.jpg">
      <div align="center"></div>
      </TD>
      </TR>
      <TR>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=69 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=144 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=354 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=33 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=9 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=165 HEIGHT=1 ALT=""></TD>
      <TD>
      <IMG SRC="images/spacer.gif" WIDTH=26 HEIGHT=1 ALT=""></TD>
      </TR>
      </TABLE>
      <!-- End ImageReady Slices -->
      </BODY>
      </HTML>

      while the aweber responder code is this below:

      <!-- AWeber Web Form Generator 3.0 -->
      <style type="text/css">
      #af-form-1671911655 .af-body .af-textWrap{width:98%;display:block;float:none;}
      #af-form-1671911655 .af-body input.text, #af-form-1671911655 .af-body textarea{background-color:#FFFFFF;border-color:#D9D9D9;border-width:1px;border-style:solid;color:#C7C7C7;text-decoration:none;font-style:normal;font-weight:normal;font-size:24px;font-family:Trebuchet MS, sans-serif;}
      #af-form-1671911655 .af-body input.text:focus, #af-form-1671911655 .af-body textarea:focus{background-color:#FFFAD6;border-color:#030303;border-width:1px;border-style:solid;}
      #af-form-1671911655 .af-body label.previewLabel{display:block;float:none;text-align:left;width:auto;color:#CCCCCC;text-decoration:none;font-style:normal;font-weight:normal;font-size:24px;font-family:Helvetica, sans-serif;}
      #af-form-1671911655 .af-body{padding-bottom:15px;padding-top:15px;background-repeat:no-repeat;background-position:inherit;background-image:none;color:#CCCCCC;font-size:11px;font-family:Verdana, sans-serif;}
      #af-form-1671911655 .af-quirksMode{padding-right:60px;padding-left:60px;}
      #af-form-1671911655 .af-standards .af-element{padding-right:60px;padding-left:60px;}
      #af-form-1671911655 .buttonContainer input.submit{background-color:#0479c2;background-image:url("http://aweber.com/images/forms/plain/buttons/grey.png");color:#FFFFFF;text-decoration:none;font-style:normal;font-weight:normal;font-size:24px;font-family:Helvetica, sans-serif;}
      #af-form-1671911655 .buttonContainer input.submit{width:auto;}
      #af-form-1671911655 .buttonContainer{text-align:center;}
      #af-form-1671911655 button,#af-form-1671911655 input,#af-form-1671911655 submit,#af-form-1671911655 textarea,#af-form-1671911655 select,#af-form-1671911655 label,#af-form-1671911655 optgroup,#af-form-1671911655 option{float:none;position:static;margin:0;}

      #af-form-1671911655 div{margin:0;}
      #af-form-1671911655 form,#af-form-1671911655 textarea,.af-form-wrapper,.af-form-close-button,#af-form-1671911655 img{float:none;color:inherit;position:static;backg round-color:none;border:none;margin:0;padding:0;}
      #af-form-1671911655 input,#af-form-1671911655 button,#af-form-1671911655 textarea,#af-form-1671911655 select{font-size:100%;}
      #af-form-1671911655 select,#af-form-1671911655 label,#af-form-1671911655 optgroup,#af-form-1671911655 option{padding:0;}
      #af-form-1671911655,#af-form-1671911655 .quirksMode{width:100%;max-width:368px;}
      #af-form-1671911655.af-quirksMode{overflow-x:hidden;}
      #af-form-1671911655{background-color:#FFFFFF;border-color:#CFCFCF;border-width:1px;border-style:none;}
      #af-form-1671911655{display:block;}
      #af-form-1671911655{overflow:hidden;}
      .af-body .af-textWrap{text-align:left;}
      .af-body input.image{border:none!important;}
      .af-body input.submit,.af-body input.image,.af-form .af-element input.button{float:none!important;}
      .af-body input.text{width:100%;float:none;padding:2px!impor tant;}
      .af-body.af-standards input.submit{padding:4px 12px;}
      .af-clear{clear:both;}
      .af-element label{text-align:left;display:block;float:left;}
      .af-element{padding:5px 0;}
      .af-form-wrapper{text-indent:0;}
      .af-form{text-align:left;margin:auto;}
      .af-quirksMode .af-element{padding-left:0!important;padding-right:0!important;}
      .lbl-right .af-element label{text-align:right;}
      body {
      }
      </style>
      <form method="post" class="af-form-wrapper" accept-charset="iso-8859-1" action="http://www.aweber.com/scripts/addlead.pl" >
      <div style="display: none;">
      <input type="hidden" name="meta_web_form_id" value="1671911655" />
      <input type="hidden" name="meta_split_id" value="" />
      <input type="hidden" name="listname" value="awlist3598377" />
      <input type="hidden" name="redirect" value="http://www.aweber.com/thankyou-coi.htm?m=text" id="redirect_ec7904a5a53195e877eb75cef8f125e2" />
      <input type="hidden" name="meta_redirect_onlist" value="http://www.mysextricks.com/salespage.html" />
      <input type="hidden" name="meta_adtracking" value="rock_star" />
      <input type="hidden" name="meta_message" value="1" />
      <input type="hidden" name="meta_required" value="name,email" />

      <input type="hidden" name="meta_tooltip" value="" />
      </div>
      <div id="af-form-1671911655" class="af-form"><div id="af-body-1671911655" class="af-body af-standards">
      <div class="af-element">
      <label class="previewLabel" for="awf_field-66080751">Name: </label>
      <div class="af-textWrap">
      <input id="awf_field-66080751" type="text" name="name" class="text" value="" onfocus=" if (this.value == '') { this.value = ''; }" onblur="if (this.value == '') { this.value='';} " tabindex="500" />
      </div>
      <div class="af-clear"></div></div>
      <div class="af-element">
      <label class="previewLabel" for="awf_field-66080752">Email:</label>
      <div class="af-textWrap"><input class="text" id="awf_field-66080752" type="text" name="email" value="" tabindex="501" onfocus=" if (this.value == '') { this.value = ''; }" onblur="if (this.value == '') { this.value='';} " />
      </div><div class="af-clear"></div>
      </div>
      <div class="af-element buttonContainer">
      <input name="submit" id="af-submit-image-1671911655" type="image" class="image" style="background: none; max-width: 100%;" alt="Submit Form" src="http://aweber.com/images/forms/plain/buttons/grey.png" tabindex="502" />
      <div class="af-clear"></div>
      </div>
      </div>
      </div>
      <div style="display: none;"><img src="http://forms.aweber.com/form/displays.htm?id=jGzsjJyMjGysrA==" alt="" /></div>
      </form>
      <script type="text/javascript">
      <!--
      (function() {
      var IE = /*@cc_on!@*/false;
      if (!IE) { return; }
      if (document.compatMode && document.compatMode == 'BackCompat') {
      if (document.getElementById("af-form-1671911655")) {
      document.getElementById("af-form-1671911655").className = 'af-form af-quirksMode';
      }
      if (document.getElementById("af-body-1671911655")) {
      document.getElementById("af-body-1671911655").className = "af-body inline af-quirksMode";
      }
      if (document.getElementById("af-header-1671911655")) {
      document.getElementById("af-header-1671911655").className = "af-header af-quirksMode";
      }
      if (document.getElementById("af-footer-1671911655")) {
      document.getElementById("af-footer-1671911655").className = "af-footer af-quirksMode";
      }
      }
      })();
      -->
      </script>

      <!-- /AWeber Web Form Generator 3.0 -->



      thank you very much for your help.
      {{ DiscussionBoard.errors[9545512].message }}
  • Profile picture of the author OnlineJam
    hello can anyone tell me if this is the autoresponder or which part of it i have to use in the squeeze page etc thx so much.... it has two sections with the word 'begin', je suis definitely newbie!
    _____________________________________________
    function argwa_form_reset() {
    global $wpdb;
    $subscribe = '<!-- [GWA] AutoResponder Begin -->'."\n".'<form name="ARGWA" action="'.get_bloginfo('url').'" method="post"><strong>Name:</strong>&nbsp;<input id="argwa_name" name="gwaname" size="16" type="text" /><br /><strong>Email:</strong>&nbsp;<input id="argwa_email" name="gwaemail" size="16" type="text" /><br /><input class="button" onclick="return gwaCheckForm1(this.form)" name="Add" type="submit" value="SUBSCRIBE" /><input name="act" type="hidden" value="s_add" /><input name="listid" type="hidden" value="1" /></form>'."\n".'<!-- [GWA] AutoResponder End -->';
    $wpdb->query( "UPDATE `".$wpdb->prefix."ar_gwa_lists` set `xSubscribe`='".mysql_real_escape_string($subscrib e)."' WHERE xID='1'" );
    update_option('argwa_error',__("Subscription Form reset to default."));
    }

    function argwa_form_page() {
    global $wpdb;
    $qry = 'UPDATE '.$wpdb->prefix.'ar_gwa_lists SET xSubscribe="'.mysql_real_escape_string($_POST['mSubForm'.$_POST['Llid']]).'" WHERE xID='.$_POST['Llid'];
    $r=$wpdb->query($qry);
    # $wpdb->show_errors();
    update_option('argwa_error',__("Subscription Form edited successfully."));
    }

    function argwa_unsubscribe_page() {
    global $wpdb;
    if($_POST['argwa_ur_url'.$_POST['Llid']] && $_POST['argwa_ur_url'.$_POST['Llid']] != 'http://') { update_option('argwa_ur_url'.$_POST['Llid'],$_POST['argwa_ur_url'.$_POST['Llid']]);} else {update_option('argwa_ur_url'.$_POST['Llid'],'');}
    if($_POST['argwa_ur_page'.$_POST['Llid']]) { update_option('argwa_ur_page'.$_POST['Llid'],$_POST['argwa_ur_page'.$_POST['Llid']]);} else {update_option('argwa_ur_page'.$_POST['Llid'],'');}
    if($_POST['argwa_ur_tpl'.$_POST['Llid']]) { update_option('argwa_ur_tpl'.$_POST['Llid'],$_POST['argwa_ur_tpl'.$_POST['Llid']]);} else {update_option('argwa_ur_tpl'.$_POST['Llid'],'');}

    if(isset($_POST['argwa_ur'.$_POST['Llid']])) {
    $qry = 'UPDATE '.$wpdb->prefix.'ar_gwa_pages SET pUnsub="'.mysql_real_escape_string($_POST['argwa_ur'.$_POST['Llid']]).'" WHERE pLID='.$_POST['Llid'];
    $r=$wpdb->query($qry);
    # $wpdb->show_errors();
    update_option('argwa_error',__("Unsubscribe page content edited successfully."));
    }
    }

    function argwa_subscribe_page() {
    global $wpdb;
    if($_POST['argwa_sr_url'.$_POST['Llid']] && $_POST['argwa_sr_url'.$_POST['Llid']] != 'http://') { update_option('argwa_sr_url'.$_POST['Llid'],$_POST['argwa_sr_url'.$_POST['Llid']]);} else {update_option('argwa_sr_url'.$_POST['Llid'],'');}
    if($_POST['argwa_sr_page'.$_POST['Llid']]) { update_option('argwa_sr_page'.$_POST['Llid'],$_POST['argwa_sr_page'.$_POST['Llid']]);} else {update_option('argwa_sr_page'.$_POST['Llid'],'');}
    if($_POST['argwa_sr_tpl'.$_POST['Llid']]) { update_option('argwa_sr_tpl'.$_POST['Llid'],$_POST['argwa_sr_tpl'.$_POST['Llid']]);} else {update_option('argwa_sr_tpl'.$_POST['Llid'],'');}

    if(isset($_POST['argwa_sr'.$_POST['Llid']])) {
    $qry = 'UPDATE '.$wpdb->prefix.'ar_gwa_pages SET pSub="'.mysql_real_escape_string($_POST['argwa_sr'.$_POST['Llid']]).'" WHERE pLID='.$_POST['Llid'];
    $r=$wpdb->query($qry);
    # $wpdb->show_errors();
    update_option('argwa_error',__("Subscription page content edited successfully."));
    }
    }
    }

    function argwa_get_listname($listid) {
    global $wpdb;
    $qry = "SELECT xName FROM ".$wpdb->prefix."ar_gwa_lists WHERE xID='".$listid."'";
    return $wpdb->get_var($qry);
    }

    function argwa_export_form() {
    global $wpdb;
    $ll = $_GET['lid'];
    echo '<form name="mForm" method="post" action="?page=argwa_page"><span style="font-size:10pt">';
    echo __("Exporting Leads from List",'argwa').' <strong>'.argwa_get_listname($ll).'</strong>';
    echo '<p><textarea id="lImport" class="lImport" name="lImport" style="width:600px; height:240px;">';
    $leads = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ar_gwa_leads WHERE lLID=".$ll);
    if(count($leads[0])<1) echo __('No Leads','argwa'); else
    foreach($leads as $l) echo $l->lName.",".$l->lEmail.",".$l->lField1.",".$l->lField2.",".$l->lField3.",".$l->lField4.",".$l->lField5."\n";
    echo '</textarea>';
    if(isset($_GET['lid']))
    echo '<input type="hidden" name="mLID" value="'.$_GET['lid'].'">';
    wp_nonce_field('argwa_import','argwa_import_nonce' );
    echo '</span></form>';
    }

    function argwa_import_form() {
    global $wpdb;
    $ll = $_GET['lid'];
    echo '<form name="mForm" method="post" action="?page=argwa_page"><span style="font-size:10pt">';
    echo __("Importing Leads to List",'argwa').' <strong>'.argwa_get_listname($ll).'</strong>';
    echo '<p><input type="submit" name="argwa_import_leads" value="Import Leads" class="button">&nbsp;<a href="http://wordpressemailsoftware.com" style="text-decoration:none;font-weight:normal;color:#21759B;;" target="_blank" title="For DIRECT IMPORT (ALREADY CONFIRMED) and SINGLE OPT-IN click to GO PRO NOW."><input type="checkbox" name="confirm_leads" checked disabled> '.__("Send double opt-in confirm message and link.",'argwa').'</a>';
    echo '<p>Add email leads (each lead record entered must be on a single line) and must include name and email. May also include up to five (5) extra data fields on the same line. Separate all fields with a comma (,) and escape all commas in your data fields with a backslash (\,). <b><i>Always press [RETURN] at the end of each line entered.</p>
    <p><textarea id="lImport" class="lImport" name="lImport" style="width:600px; height:240px;"></textarea>';
    if(isset($_GET['lid']))
    echo '<input type="hidden" name="mLID" value="'.$_GET['lid'].'">';
    wp_nonce_field('argwa_import_leads','argwa_import_ leads_nonce');
    echo '</span></form>';
    }


    function argwa_add_form() {
    global $wpdb;

    if(isset($_GET['mid']) || isset($_GET['lid'])) {
    if(isset($_GET['mid'])) { $row = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ar_gwa_msg WHERE mID='{$_GET['mid']}'",ARRAY_A); }
    $row = $row[0];
    $opt = array('text' => '', 'html' => '');
    $opt[$row['mType']] = 'selected';
    if($_GET['lid']) { $ll = $_GET['lid']; }
    else $ll = $row['mLID'];
    echo '<div class="wrap"><form name="mForm" method="post" action="?page=argwa_page">';
    echo '<table align="center"><tr><td>'.__("LIST",'argwa').'</td><td style="font-size:13pt;"><strong>'.argwa_get_listname($ll).'</strong></td></tr>';
    if($row['mDate']!='' || isset($_GET['mdate'])) {
    if(isset($_GET['mdate'])) $dd=$_GET['mdate']; else $dd =$row['mDate'];
    echo '<tr><td>'.__("Date",'argwa').'</td>'.'<td><input type="text" name="mDate" value="'.$dd.'"> YYYY-MM-DD</td></tr>';
    } else if(!isset($_GET['argwasend']))
    echo '<tr><td>'.__("Day",'argwa').'</td>'.'<td><input type="text" name="mDay" style="width:100px;" value="'.$row['mDay'].'"> (0 - 356)</td></tr>';
    echo '<tr><td>'.__("Subject",'argwa').'</td>';
    echo '<td><input type="text" name="mSubject" style="width:500px;" maxlength="250" value="'.stripslashes($row['mSubject']).'"></td></tr>';
    echo '<tr><td colspan=2><div id="tabs"><ul><li><a href="#tabs-1">Text</a></li><li><a href="#tabs-2">HTML</a></li></ul><div id="tabs-1"><textarea id="editorContent" name="mBodyText" style="width:500px; height:180px;">'.stripslashes(htmlentities($row['mBodyText'])).'</textarea></div>';
    echo '<div id="tabs-2">';
    echo '<textarea id="mBodyHtml" class="mBodyHtml" name="mBodyHtml" style="width:500px; height:180px;">'.stripslashes(htmlentities($row['mBodyHtml'])).'</textarea>';
    ?>
    <script type="text/javascript" charset="utf-8">
    jQuery(document).ready(function() {
    var opts5 = {
    cssClass : 'el-rte',
    // lang : 'ru',
    height : 100,
    width : 500,
    toolbar : 'compact',
    cssfiles : ['css/elrte-inner.css']
    }
    jQuery('#mBodyHtml').elrte(opts5);
    })
    </script>
    <?php
    echo '</div></div></td></tr>';
    ?>
    <script>
    jQuery(document).ready(function($) {
    $('#tabs').tabs();
    });
    </script>
    <tr>
    <td colspan=2 style="padding:5px;width:450px;"><?php _e('<strong>Personalize your messages</strong> and use these custom tags in your emails.','argwa');?> <strong style="font-size:9pt;"> <?Name?> <?Email?> <?Unsubscribe?> <?Field1?> <?Field2?> <?Field3?> <?Field4?> <?Field5?> <?php if(file_exists(dirname(__FILE__).'/ar_gwa_user_edit.php'))echo "<?Update?>";?></strong></td>
    </tr><?php
    if(isset($_GET['mid'])) echo '<tr><td colspan=2><input name="argwa_update_message" type="submit" class="button-primary" value="'.__("Update Autoresponder Message",'argwa').'">'; else if(!isset($_GET['argwasend'])) echo '<tr><td colspan=2><input name="argwa_add_message" type="submit" class="button-primary" value="'.__("Add New Autoresponder Message",'argwa').'">'; else echo '<tr><td colspan=2><input name="argwa_send_message" type="submit" class="button-primary" value="'.__("Send Instant Broadcast Message",'argwa').'">';
    if( !class_exists('ar_gwa_attach') & file_exists(dirname(__FILE__).'/ar_gwa_attach.php')) include_once(dirname(__FILE__).'/ar_gwa_attach.php');
    if(class_exists('ar_gwa_attach')) { echo "&nbsp;<span style='color:#00f;font-weight:bold;'>".__("ATTACH FILE:",'argwa')."</span>&nbsp;".admin_ar_gwa_attach($row['mAttach']).''; }
    echo '</td></tr></table>';
    if(isset($_GET['mid']))
    echo '<input type="hidden" name="mID" value="'.$_GET['mid'].'">';
    if(isset($_GET['lid']))
    echo '<input type="hidden" name="mLID" value="'.$_GET['lid'].'">';
    wp_nonce_field('argwa_message','argwa_message_nonc e');
    echo '</form>';
    echo '<div style="margin-left:60px;margin-top:10px;">';
    if(class_exists('ar_gwa_attach') && ($tcc = new ar_gwa_attach)) $tcc->ar_gwa_upload();
    echo '</div>';
    } // if
    }

    function argwa_install () {
    global $wpdb;

    $table_name = $wpdb->prefix . "ar_gwa_leads";
    $table_name2 = $wpdb->prefix . "ar_gwa_queue";
    if((@$wpdb->get_var("show tables like '$table_name'") == $table_name) &&
    (@$wpdb->get_var("show tables like '$table_name2'") != $table_name2)) {
    @$wpdb->query("ALTER TABLE `".$wpdb->prefix."ar_gwa_leads` RENAME `".$wpdb->prefix."ar_gwa_leads_tmp`");
    @$wpdb->query("ALTER TABLE `".$wpdb->prefix."ar_gwa_msg` RENAME `".$wpdb->prefix."ar_gwa_msg_tmp`");
    $repopulate = 1;
    }
    $bloginfo = array('url' => get_bloginfo('url'),
    'name' => mysql_real_escape_string(get_bloginfo('name')),
    'admin' => get_bloginfo('admin_name'),
    'email' => get_bloginfo('admin_email'));
    add_option('ar_gwa_addsub_1','checked');
    add_option('ar_gwa_wrap_1','50');
    add_option('ar_gwa_notify_1','checked');
    add_option('ar_gwa_unsub','Click to unsubscribe.');
    add_option('ar_gwa_no_spam','0');
    if(!(get_option('ar_gwa_aff_id'))){
    add_option('ar_gwa_aff_id','1');
    add_option('ar_gwa_aff_url','http://wordpressemailsoftware.com');
    add_option('ar_gwa_aff_text','Free Autoresponder');
    add_option('ar_gwa_aff_title','Software for Email Marketing');
    }
    if(get_option('ar_gwa_cb') != "unbranded")
    update_option('ar_gwa_cb_1','checked');
    update_option('ar_gwa_remove_1','checked');
    add_option('ar_gwa_enc_1','8bit');
    add_option('ar_gwa_char_1','UTF-8');
    add_option('ar_gwa_reg_optin','checked');
    add_option('ar_gwa_from',$bloginfo['email']);
    wp_schedule_event((time()+86400), 'daily', 'argwa_daily_event');


    $dn = 0;
    $table_name = $wpdb->prefix . "ar_gwa_leads";
    if(@$wpdb->get_var("show tables like '$table_name'") != $table_name) {

    $sql = "CREATE TABLE `" . $table_name . "` (
    `lID` int(11) NOT NULL auto_increment,
    `lLID` int(11) NOT NULL,
    `lName` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lEmail` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lDateEntry` date default NULL,
    `lDateOut` date default NULL,
    `lMOut` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lCnf` varchar(65) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `lTime` timestamp NOT NULL,
    `lIP` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `lDNS` varchar(65) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `lField1` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lField2` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lField3` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lField4` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `lField5` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    PRIMARY KEY (`lID`),
    KEY `lCnf` (`lCnf`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
    $results = @$wpdb->query( $sql );
    }

    if(@$wpdb->get_var("show columns from $table_name like 'lField1'") != 'lField1') {
    $psql="ALTER TABLE `$table_name`
    ADD `lField1` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    ADD `lField2` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    ADD `lField3` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    ADD `lField4` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    ADD `lField5` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL";
    $results = @$wpdb->query( $psql );
    }

    $table_name = $wpdb->prefix . "ar_gwa_lists";
    if(@$wpdb->get_var("show tables like '$table_name'") != $table_name) {
    $sql = "CREATE TABLE `" . $table_name . "` (
    `xID` int(11) NOT NULL auto_increment,
    `xName` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `xEmail` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `xSubscribe` text,
    `xLabel` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `xPage` int(4) NOT NULL,
    `xReturn` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    PRIMARY KEY (`xID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
    $results = @$wpdb->query( $sql );
    $subscribe = mysql_real_escape_string('<!-- [GWA] AutoResponder Begin -->'."\n".'<form name="ARGWA" action="'.get_bloginfo('url').'" method="post"><strong>Name:</strong>&nbsp;<input id="argwa_name" name="gwaname" size="16" type="text" /><br /><strong>Email:</strong>&nbsp;<input id="argwa_email" name="gwaemail" size="16" type="text" /><br /><input class="button" onclick="return gwaCheckForm1(this.form)" name="Add" type="submit" value="SUBSCRIBE" /><input name="act" type="hidden" value="s_add" /><input name="listid" type="hidden" value="1" /></form>'."\n".'<!-- [GWA] AutoResponder End -->');
    $sql = "INSERT INTO `".$table_name."` (`xID`, `xName`, `xEmail`, `xSubscribe`, `xLabel`, `xPage`) values (1,'{$bloginfo['name']}','{$bloginfo['email']}','$subscribe','{$bloginfo['name']}','')";
    $results = @$wpdb->query( $sql );
    } else {
    $results = @$wpdb->query( "ALTER TABLE `".$table_name."` CHANGE `xReturn` `xReturn` VARCHAR( 255 ) NOT NULL");
    }

    $table_name = $wpdb->prefix . "ar_gwa_pages";
    if(@$wpdb->get_var("show tables like '$table_name'") != $table_name) {
    $sql = "CREATE TABLE `" . $table_name . "` (
    `pID` int(11) NOT NULL auto_increment,
    `pLID` int(11) default NULL,
    `pConfMsg` text CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `pConf` text CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `pSub` text CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `pUnsub` text CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `pErr` text CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    PRIMARY KEY (`pID`),
    INDEX (`pLID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";
    $results = @$wpdb->query( $sql );
    $pConf = get_option('ar_gwa_addlead');
    if(!isset($pConf) || $pConf=='') $pConf = "You have been subscribed successfully.";
    $pUnsub = get_option('ar_gwa_rmvlead');
    if(!isset($pUnSub) || $pUnsub=='') $pUnsub = "You have been unsubscribed successfully.";
    $pErr = get_option('ar_gwa_badlead');
    if(!isset($pErr) || $pErr=='') $pErr = "There was a problem. Please contact the blog administrator for assistance.";
    @$wpdb->query("INSERT INTO ".$wpdb->prefix."ar_gwa_pages (`pLID`,`pConfMsg`,`pSub`,`pConf`,`pUnsub`,`pErr`) VALUES ('1','".__("Please click the link to confirm your subscription.",'argwa')."','".__("Please check your email to confirm your subscription.",'argwa')."','".$wpdb->escape($pConf)."','".$wpdb->escape($pUnsub)."','".$wpdb->escape($pErr)."')");
    }

    $table_name = $wpdb->prefix . "ar_gwa_msg";
    if(@$wpdb->get_var("show tables like '$table_name'") != $table_name) {
    $sql = "CREATE TABLE `" . $table_name . "` (
    `mID` int(11) NOT NULL auto_increment,
    `mLID` int(11) default NULL,
    `mSubject` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    `mBody` text CHARACTER SET utf8 COLLATE utf8_general_ci ,
    `mBodyText` text CHARACTER SET utf8 COLLATE utf8_general_ci ,
    `mBodyHtml` text CHARACTER SET utf8 COLLATE utf8_general_ci ,
    `mDay` int(2) default NULL,
    `mType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL,
    PRIMARY KEY (`mID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";
    $results = @$wpdb->query( $sql );
    }

    if($wpdb->get_var("SHOW columns FROM `".$wpdb->prefix."ar_gwa_msg` like 'mBodyText'") != 'mBodyText') {
    $psql="ALTER TABLE `".$wpdb->prefix."ar_gwa_msg` ADD `mBodyText` text";
    @$results = $wpdb->query( $psql );
    $psql="ALTER TABLE `".$wpdb->prefix."ar_gwa_msg` ADD `mBodyHtml` text";
    @$results = $wpdb->query( $psql );
    if($rec = @$wpdb->get_results("SELECT * FROM `".$wpdb->prefix."ar_gwa_msg` WHERE 1",ARRAY_A)) {
    foreach($rec as $r) {
    if($r['mType']=='text')
    @$wpdb->query( "UPDATE ".$wpdb->prefix."ar_gwa_msg SET mBodyText=mBody WHERE mID=".$r['mID'] );
    else
    @$wpdb->query( "UPDATE ".$wpdb->prefix."ar_gwa_msg SET mBodyHtml=mBody WHERE mID=".$r['mID'] );
    }
    }
    }

    $table_name = $wpdb->prefix . "ar_gwa_log";
    if(@$wpdb->get_var("show tables like '$table_name'") != $table_name) {
    $sql = "CREATE TABLE `$table_name` (
    `id` int(11) NOT NULL auto_increment,
    `newsletterQID` int(11) NOT NULL default 0,
    `method` set('mail','smtp') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `From` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `FromName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `Host` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `SMTPAuth` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `Username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `Password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `recepientMail` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `recepientName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `body` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
    `ContentType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `priority` int(1) NOT NULL default '0',
    `SendDate` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    `QLID` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci default NOT NULL default '',
    `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci default NOT NULL default '',
    `charset` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci default NOT NULL default '',
    `encoding` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci default NOT NULL default '',
    `Response` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL default '',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
    $results = @$wpdb->query( $sql );
    }
    if($repopulate==1) {
    $table_name = 'ar_gwa_leads';
    $rec = @$wpdb->get_results("SELECT * FROM ".$wpdb->prefix.$table_name."_tmp");
    foreach($rec as $re)
    @$wpdb->query("INSERT INTO ".$wpdb->prefix.$table_name." SET lID=NULL, lLID='1',lName='{$re->lName}',lEmail='{$re->lEmail}',lDateEntry='{$re->lDateEntry}',lDateOut='{$re->lDateOut}',lMOut='{$re->lMOut}',lCnf='{$re->lCnf}',lTime='',lIP='{$re->lIP}',lDNS='{$re->lDNS}', lField1='',lField2='',lField3='',lField4='',lField 5=''");

    $table_name = 'ar_gwa_msg';
    @$wpdb->query("INSERT INTO ".$wpdb->prefix.$table_name." (SELECT * FROM ".$wpdb->prefix.$table_name."_tmp)");
    @$wpdb->query("UPDATE ".$wpdb->prefix.$table_name." set mLID='1'");
    }
    if (wp_next_scheduled('ar_gwa_daily_event')) wp_clear_scheduled_hook('ar_gwa_daily_event');
    }

    function argwa_responder_start() {
    if (!wp_next_scheduled('argwa_daily_event') || ((wp_next_scheduled('argwa_daily_event')-time())<0) ) {
    wp_clear_scheduled_hook('argwa_daily_event');
    $sched = time()+86000;
    wp_schedule_event( $sched, 'daily', 'argwa_daily_event' );
    argwa_do_this_daily('none');
    }
    }

    function argwa_do_this_daily($n=NULL) {
    global $wpdb;
    $ar_cnt = 0;
    $ms = new ARGWAMailProcess();
    $qr="SELECT MAX(mDay) FROM ".$wpdb->prefix."ar_gwa_msg";
    $rs = @$wpdb->get_results($qr,ARRAY_A);
    $qry = "SELECT TO_DAYS(current_date) as AA, TO_DAYS(lDateEntry) as BB, lID, lLID, lMOut FROM ".$wpdb->prefix."ar_gwa_leads WHERE lCnf=1 ORDER BY lID DESC";
    $res = @$wpdb->get_results($qry,ARRAY_A);
    if(count($res)>0) {
    foreach($res as $row)
    {
    $dif = $row['AA'] - $row['BB'];
    if($dif > 0 && $dif < 1000)
    {
    $mDay = $row['lMOut'] + 1;
    while($mDay <= $dif)
    {
    if($ms->setLead($row['lID']) && $ms->setMsg($mDay,$row['lLID']))
    {
    $ms->mailLead();
    $ar_cnt++;
    }
    $mDay++;
    }
    }
    }
    }
    if (!(wp_next_scheduled('argwa_daily_event'))) {
    wp_clear_scheduled_hook('argwa_daily_event');
    wp_schedule_event( time()+86400, 'daily', 'argwa_daily_event' );
    }
    }

    function set_argwa_options($s=NULL)
    {
    global $wpdb;
    $sendEmailSub =1;
    if($_REQUEST['ar_gwa_addsub']=="" && isset($s) && $s==1 && isset($_REQUEST['ar_gwa_submit_cb']))
    $sendEmailSub =0;
    if($_REQUEST['ar_gwa_unsub']!="")
    $sendEmail = $_REQUEST['ar_gwa_unsub'];
    else
    $sendEmail = get_option('ar_gwa_unsub');

    delete_option('ar_gwa_addsub');
    delete_option('ar_gwa_unsub');
    add_option('ar_gwa_addsub',$sendEmailSub,'');
    add_option('ar_gwa_unsub',$sendEmail,'');
    }

    function unset_argwa_options()
    {
    global $wpdb;
    if(get_option('ar_gwa_delete')=='checked') {
    $sql = "DELETE FROM ".$wpdb->prefix.'options WHERE option_name LIKE "ar_gwa_%" OR option_name LIKE "argwa_%"';
    @$wpdb->query($sql);
    $sql = "DROP table ".$wpdb->prefix."ar_gwa_leads;";
    @$wpdb->query($sql);
    $sql = "DROP table ".$wpdb->prefix."ar_gwa_leads_tmp;";
    @$wpdb->query($sql);
    $sql = "DROP TABLE ".$wpdb->prefix."ar_gwa_lists;";
    @$wpdb->query($sql);
    $sql = "DROP TABLE ".$wpdb->prefix."ar_gwa_msg;";
    @$wpdb->query($sql);
    $sql = "DROP TABLE ".$wpdb->prefix."ar_gwa_msg_tmp;";
    @$wpdb->query($sql);
    $sql = "DROP TABLE ".$wpdb->prefix."ar_gwa_log;";
    @$wpdb->query($sql);
    $sql = "DROP TABLE ".$wpdb->prefix."ar_gwa_pages;";
    @$wpdb->query($sql);
    }
    wp_clear_scheduled_hook('argwa_daily_event');
    wp_clear_scheduled_hook('argwa_regular_event');

    delete_option('ar_gwa_delete');
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////

    function ar_gwa_js_admin_header() {
    wp_print_scripts( array( 'sack' ));?>
    <script type="text/javascript">
    //<![CDATA[
    function ar_gwa_name_update( name_field, id_field, email_field )
    {
    var mysack = new sack(
    "<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
    mysack.execute = 1;
    mysack.method = 'POST';
    mysack.setVar( "action", "ar_gwa_name_update" );
    mysack.setVar( "lID", id_field );
    mysack.setVar( "lName", name_field.value );
    mysack.setVar( "lEmail", email_field );
    mysack.encVar( "cookie", document.cookie, false );
    mysack.onError = function() { alert(__('Ajax error updating record','argwa'))};
    mysack.runAJAX();
    return true;
    }

    function ar_gwa_email_update( email_field, id_field )
    {
    var mysack = new sack(
    "<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
    mysack.execute = 1;
    mysack.method = 'POST';
    mysack.setVar( "action", "ar_gwa_email_update" );
    mysack.setVar( "lID", id_field );
    mysack.setVar( "lEmail", email_field.value );
    mysack.encVar( "cookie", document.cookie, false );
    mysack.onError = function() { alert(__('Ajax error updating record','argwa'))};
    mysack.runAJAX();
    return true;
    }

    function ar_gwa_day_update( day_field, id_field, email_field )
    {
    var mysack = new sack(
    "<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
    mysack.execute = 1;
    mysack.method = 'POST';
    mysack.setVar( "action", "ar_gwa_day_update" );
    mysack.setVar( "lID", id_field );
    mysack.setVar( "lEmail", email_field );
    mysack.setVar( "lMOut", day_field.value );
    mysack.encVar( "cookie", document.cookie, false );
    mysack.onError = function() { alert(__('Ajax error updating record','argwa'))};
    mysack.runAJAX();
    return true;
    }

    function ar_gwa_fields_update( id_field, field_one, field_two, field_three, field_four, field_five )
    {
    var mysack = new sack(
    "<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
    mysack.execute = 1;
    mysack.method = 'POST';
    mysack.setVar( "action", "ar_gwa_fields_update" );
    mysack.setVar( "lID", id_field );
    mysack.setVar( "field_1", field_one.value );
    mysack.setVar( "field_2", field_two.value );
    mysack.setVar( "field_3", field_three.value );
    mysack.setVar( "field_4", field_four.value );
    mysack.setVar( "field_5", field_five.value );
    mysack.encVar( "cookie", document.cookie, false );
    mysack.onError = function() { alert(__('Ajax error updating record','argwa'))};
    mysack.runAJAX();
    return true;
    }
    //]]>
    </script>
    <?php
    }

    function ar_gwa_name_update() {
    global $wpdb;
    $qry = 'UPDATE `'.$wpdb->prefix.'ar_gwa_leads` SET lName = "'.$wpdb->escape($_POST['lName']).'" WHERE lID="'.$wpdb->escape($_POST['lID']).'"';
    $z = $wpdb->query($qry);
    $val = '<input onblur="sss = confirm(\''.__("Confirm changes to",'argwa')."&nbsp;".$_POST['lEmail'].'?\');if(sss==true)ar_gwa_name_update(document.ge tElementById(\'argwaleadname'.$_POST['lID'].',1\'),'.$_POST['lID'].',\''.$_POST['lEmail'].'\');return false;" type="text" name="lLead" id="argwaleadname'.$_POST['lID'].'" value="'.$_POST['lName'].'" size="22">';

    die("document.getElementById('tdname".$_POST['lID']."').innerHTML = '".addslashes($val)."'
    alert('".__("Changes saved to database.",'argwa')."')");
    }

    function ar_gwa_email_update() {
    global $wpdb;
    $qry = 'UPDATE `'.$wpdb->prefix.'ar_gwa_leads` SET lEmail = "'.$wpdb->escape($_POST['lEmail']).'" WHERE lID="'.$wpdb->escape($_POST['lID']).'"';
    $z = $wpdb->query($qry);
    $val = '<input onblur="sss = confirm(\''.__("Confirm changes to",'argwa')."&nbsp;".$_POST['lEmail'].'?\');if(sss==true)ar_gwa_email_update(document.g etElementById(\'argwaleademail'.$_POST['lID'].'\'),'.$_POST['lID'].');return false;" type="text" name="lEmail" id="argwaleademail'.$_POST['lID'].'" value="'.$_POST['lEmail'].'" size="22">';

    die("document.getElementById('tdemail".$_POST['lID']."').innerHTML = '".addslashes($val)."'
    alert('".__("Changes saved to database.",'argwa')."')");
    }

    function ar_gwa_day_update() {
    global $wpdb;
    if(preg_match("/^\d+$/",$_POST['lMOut'])) {
    $qry = 'UPDATE `'.$wpdb->prefix.'ar_gwa_leads` SET lMOut = "'.$wpdb->escape($_POST['lMOut']).'" , lDateEntry = "'.date('Y-m-d', strtotime('-'.($_POST['lMOut']+1).' days')).'" WHERE lID="'.$wpdb->escape($_POST['lID']).'"';
    $z = $wpdb->query($qry);
    $val = '<input onblur="sss = confirm(\''.__("Confirm changes to",'argwa')."&nbsp;".$_POST['lEmail'].'?\');if(sss==true)ar_gwa_day_update(document.get ElementById(\'argwaleadday'.$_POST['lID'].'\'),'.$_POST['lID'].',\''.$_POST['lEmail'].'\');return false;" type="text" name="lMOut" id="argwaleadday'.$_POST['lID'].'" value="'.$_POST['lMOut'].'" size="3">';

    die("document.getElementById('tdday".$_POST['lID']."').innerHTML = '".addslashes($val)."'
    document.getElementById('tdentry".$_POST['lID']."').innerHTML = '".date('Y-m-d', strtotime('-'.($_POST['lMOut']+1).' days'))."'
    alert('".__("Changes saved to database.",'argwa')."')");
    } else {
    die("alert('".__("Please enter a valid Msg Day Number 0-365 only.",'argwa')."')");
    }
    }

    function ar_gwa_fields_update() {
    global $wpdb;
    #$wpdb->show_errors();
    $qry = 'UPDATE '.$wpdb->prefix.'ar_gwa_leads SET lField1 = "'.$wpdb->escape($_POST['field_1']).'" , lField2 = "'.$wpdb->escape($_POST['field_2']).'", lField3 = "'.$wpdb->escape($_POST['field_3']).'", lField4 = "'.$wpdb->escape($_POST['field_4']).'", lField5 = "'.$wpdb->escape($_POST['field_5']).'" WHERE lID="'.$wpdb->escape($_POST['lID']).'"';
    $z = $wpdb->query($qry);
    die("document.getElementById('gwatable".$_POST['lID']."').innerHTML = '".__("Updated",'argwa')."&nbsp;".$z."'");
    }

    function argwa_print_scripts() {
    wp_enqueue_script('jcap', ARGWA_PLUGIN_URL.'js/jcap.js');
    wp_enqueue_script('md5', ARGWA_PLUGIN_URL.'js/md5.js');
    }

    function argwa_reg_subscribe_user() {
    global $wpdb;
    $lName = $_REQUEST['user_login'];
    $lEmail = $_REQUEST['user_email'];
    if(is_array($_REQUEST['LIST'])){
    foreach($_REQUEST['LIST'] as $list) {
    global $wpdb;
    $qry = "INSERT INTO ".$wpdb->prefix."ar_gwa_leads(lLID, lName, lEmail, lDateEntry, lDateOut, lMOut, lCnf) VALUES('".$list."','".$lName."', '".$lEmail."' ,current_date, current_date, '-1','1')";
    $wpdb->query($qry);
    }
    }
    }

    function argwa_reg_subscribe_form() {
    global $wpdb;
    $qry = "SELECT * FROM ".$wpdb->prefix."ar_gwa_lists";
    $rec = $wpdb->get_results($qry,ARRAY_A);
    foreach($rec as $rc) {
    if(get_option('ar_gwa_reg_optin_'.$rc['xID']) == 'checked') { echo '<input type="checkbox" name="LIST[]" value="'.$rc['xID'].'" checked> '.__("Subscribe to our newsletter",'argwa').' '.$rc['xName'].'.<br /><br />'; }
    else if(get_option('ar_gwa_reg_optinb_'.$rc['xID']) == 'checked') { echo '<input type="hidden" name="LIST[]" value="'.$rc['xID'].'" checked>';}
    }
    }

    if(!function_exists('argwa_short_code')) {
    function argwa_short_code($atts) {
    global $my_argwa_metabox_plugin;
    $ats = shortcode_atts( array('listid' => 0), $atts );
    return $my_argwa_metabox_plugin->argwa_form_display($atts['listid'],1);
    }
    }

    $my_argwa_metabox_plugin = new argwa_metabox_plugin();
    if($my_argwa_metabox_plugin->help==1) add_action('admin_footer','argwa_help');
    add_action('admin_head','argwa_dashboard_alert');
    add_action('admin_print_scripts', 'ar_gwa_js_admin_header' );
    add_action('wp_print_scripts', 'argwa_print_scripts',1);
    add_action('wp_ajax_ar_gwa_name_update', 'ar_gwa_name_update' );
    add_action('wp_ajax_ar_gwa_email_update', 'ar_gwa_email_update' );
    add_action('wp_ajax_ar_gwa_day_update', 'ar_gwa_day_update' );
    add_action('wp_ajax_ar_gwa_fields_update', 'ar_gwa_fields_update' );
    add_action('widgets_init', create_function('', 'return register_widget("ARGWA_Widget");'));
    add_action( 'register_form', 'argwa_reg_subscribe_form' );
    add_action( 'user_register', 'argwa_reg_subscribe_user' );
    add_action('argwa_daily_event', 'argwa_do_this_daily');
    add_shortcode('gwa-autoresponder', 'argwa_short_code');
    add_shortcode('GWAR', 'argwa_short_code');
    register_activation_hook(__FILE__, 'argwa_install');
    register_activation_hook(__FILE__, 'argwa_responder_start');
    register_deactivation_hook(__FILE__,'unset_argwa_o ptions');

    //////////////////////////////////////////////////////////////////////////////////////////////////////
    class ARGWAMailProcess
    {
    var $lead = array();
    var $msg = array();
    var $arFrom;

    function ARGWAMailProcess()
    {
    $this->arFrom = get_option('ar_gwa_from');
    }

    function setLead($lID)
    {
    global $wpdb;
    // get lead info
    $qry = "SELECT * FROM ".$wpdb->prefix."ar_gwa_leads ,".$wpdb->prefix."ar_gwa_lists WHERE lLID = xID AND lID='$lID'";
    $res = $wpdb->get_results($qry,ARRAY_A);
    if($res)
    {
    $this->lead = $res[0];
    return 1;
    }
    return 0;
    }

    function setWPLead($lID)
    {
    global $wpdb;
    $xEmail = get_bloginfo('admin_email');
    $xName = get_bloginfo('name');
    $qry = "SELECT * FROM ".$wpdb->prefix."users WHERE ID ='$lID'";
    $res = $wpdb->get_results($qry,ARRAY_A);
    if($res)
    {
    $this->lead = $res[0];
    $this->lead['xEmail'] = $xEmail;
    $this->lead['xName'] = $xName;
    return 1;
    }
    return 0;
    }

    function setLead2($listID)
    {
    global $wpdb;
    // get lead info
    $qry = "SELECT * FROM ".$wpdb->prefix."ar_gwa_lists WHERE xID='$listID'";
    $res = $wpdb->get_results($qry,ARRAY_A);
    if($res)
    {
    $this->lead = $res[0];
    $this->lead['lEmail']=get_bloginfo('admin_email');
    $this->lead['lName']=$this->lead['xName'];
    return 1;
    }
    return 0;
    }

    function setMsg($mDay,$lLID=null)
    {
    global $wpdb;

    $this->msg['mDay'] = $mDay;
    $qry = "SELECT * FROM ".$wpdb->prefix."ar_gwa_msg WHERE mDay='$mDay'";
    if($lLID) $qry .= " AND mLID=".$lLID;
    $res = $wpdb->get_results($qry,ARRAY_A);
    if($res)
    {
    $this->msg = $res[0];
    if(!class_exists('ar_gwa_newsletter') && file_exists(dirname(__FILE__).'/ar_gwa_newsletter.php')) include_once(dirname(__FILE__).'/ar_gwa_newsletter.php');
    if(class_exists('ar_gwa_newsletter')) {if(isset($this->msg['nlid']) && ($this->msg['nlid']>0)) $this->msg['mBodyHtml'] = str_replace("{CONTENT}", $this->msg['mBodyHtml'], $wpdb->get_var("SELECT content FROM `".$wpdb->prefix."ar_gwa_newsletter` WHERE id='".$this->msg['nlid']."'"));}
    if($this->msg['mType'] == 'html') {
    $this->msg['mHeader'] = 'text/html';
    $this->msg['mBody'] = $this->msg['mBodyHtml'];
    $this->msg['mBodyAlt'] = $this->msg['mBodyText'];
    } else {
    $this->msg['mHeader'] = 'text/plain';
    $this->msg['mBody'] = $this->msg['mBodyText'];
    }
    return 1;
    }
    return 0;
    }

    function setMsg2($msg)
    {
    $this->msg['mSubject'] = $msg['mSubject'];
    $this->msg['mType'] = $msg['mType'];
    $this->msg['mAttach'] = $msg['mAttach'];
    if($msg['mType'] == 'html') {
    $this->msg['mBody'] = $msg['mBodyHtml'];
    $this->msg['mBodyAlt'] = $msg['mBodyText'];
    $this->msg['mHeader'] = 'text/html';
    } else {
    $this->msg['mHeader'] = 'text/plain';
    $this->msg['mBody'] = $msg['mBodyText'];
    }
    return 1;
    }

    function mailWPLead($mDay=null,$lID=null,$dbug=NULL,$direct =NULL)
    {
    global $wpdb;
    if(!count($this->lead) || !count($this->msg)) { return 0; }
    $this->formatMsg(1);
    $data = array(
    'method' => 'mail',
    'From' => $this->lead['xEmail'],
    'FromName' => $this->lead['xName'],
    'recepientMail' => $this->lead['user_email'],
    'recepientName' => $this->lead['display_name'],
    'subject' => $this->msg['mSubject'],
    'body' => stripslashes($this->msg['mBody']),
    'bodyAlt' => stripslashes($this->msg['mBodyAlt']),
    'ContentType' => $this->msg['mHeader'],
    'priority' => '3',
    'SendDate' => time(),
    'QLID' => $this->lead['lLID'],
    'port' => get_option('ar_gwa_smtp_port_'.$this->lead['lLID']),
    'charset' => get_option('ar_gwa_char_'.$this->lead['lLID']),
    'encoding' => get_option('ar_gwa_enc_'.$this->lead['lLID']),
    'mAttach' => $this->msg['mAttach'],
    );
    $add = argwa_add_email($data,$dbug);
    }

    function mailLead($mDay=null,$lID=null,$dbug=NULL,$direct=N ULL)
    {
    global $wpdb;
    if(!count($this->lead) || !count($this->msg)) { return 0; }
    $this->formatMsg();
    $data = array(
    'method' => 'mail',
    'From' => $this->lead['xEmail'],
    'FromName' => $this->lead['xName'],
    'recepientMail' => $this->lead['lEmail'],
    'recepientName' => $this->lead['lName'],
    'subject' => $this->msg['mSubject'],
    'body' => stripslashes($this->msg['mBody']),
    'bodyAlt' => stripslashes($this->msg['mBodyAlt']),
    'ContentType' => $this->msg['mHeader'],
    'priority' => '3',
    'SendDate' => time(),
    'QLID' => $this->lead['lLID'],
    'mAttach' => $this->msg['mAttach']
    );
    $add = $this->argwa_add_email($data,$dbug);

    if(isset($this->msg['mDay']))
    $subq = "lMOut='".$this->msg['mDay']."', ";
    $qry = "UPDATE ".$wpdb->prefix."ar_gwa_leads SET $subq lDateOut=current_date WHERE lID='".$this->lead['lID']."'";
    $wpdb->query($qry);
    }

    function argwa_add_email($params,$dbug){
    global $wpdb;
    $params['QLID'] = $this->lead['lLID'];
    $params['charset'] = get_option('ar_gwa_char_'.$this->lead['lLID']);
    $params['encoding'] = get_option('ar_gwa_enc_'.$this->lead['lLID']);

    $data=array('method' => ( isset($params['method']) ) ? $params['method'] : 'mail',
    'From' => ( isset($params['From']) ) ? $params['From'] : 'root@localhost',
    'FromName' => ( isset($params['FromName']) ) ? $params['FromName'] : 'Root Account',
    'recepientMail' => ( isset($params['recepientMail']) ) ? $params['recepientMail'] : false,
    'recepientName' => ( isset($params['recepientName']) ) ? $params['recepientName'] : '',
    'subject' => ( isset($params['subject']) ) ? $params['subject'] : false,
    'body' => ( isset($params['body']) ) ? $params['body'] : false,
    'bodyAlt' => ( isset($params['bodyAlt']) ) ? $params['bodyAlt'] : false,
    'ContentType' => ( isset($params['ContentType']) ) ? $params['ContentType'] : 'text/plain',
    'priority' => ( isset($params['priority']) ) ? $params['priority'] : '3',
    'SendDate' => ( isset($params['SendDate']) ) ? $params['SendDate'] : time(),
    'QLID' => ( isset($params['QLID']) ) ? $params['QLID'] : '1',
    'charset' => ( isset($params['charset']) ) ? $params['charset'] : false,
    'encoding' => ( isset($params['encoding']) ) ? $params['encoding'] : false,
    );
    $error=false;
    foreach ( $data as $key=>$value ){
    $sql1 .= "`".$key.'`,';
    $sql2 .= "'".$wpdb->escape($value)."',";
    if ($value===false) {
    $error=true;
    $errorMsg="Cannot send mail. Empty value for [$key]";
    }
    }
    #var_dump($data);exit;
    if ( $error===true ){
    #die( $errorMsg);
    $this->errorMsg=$errorMsg;
    return false;
    } else {
    $mime_boundary = "b1_f8294cc0b53b06489f5c1364d85c704f";
    if($data['ContentType'] =='text/html') {
    $body_text = $data['bodyAlt'];
    $body_html = $data['body'];
    $body = "--{$mime_boundary}\n" ."Content-Type: text/plain; charset=\"{$data['charset']}\"\n" ."Content-Transfer-Encoding: {$data['encoding']}\n\n" .$body_text . "\n\n";
    $body .= "--{$mime_boundary}\n" ."Content-Type: text/html; charset=\"{$data['charset']}\"\n" ."Content-Transfer-Encoding: {$data['encoding']}\n\n" .$body_html . "\n\n";
    mail($data['recepientMail'], $data['subject'], $body, "From: {$data['FromName']} <{$data['From']}>"."\r\n"."Mime-Version: 1.0\r\n"."Content-Type: multipart/alternative;\r\n boundary=\"{$mime_boundary}\"\r\n\r\n");
    } else {
    $suc = @mail($data['recepientMail']."\r\n",$data['subject']."\r\n",$data['body']."\r\n","From: {$data['FromName']} <{$data['From']}>"."\r\n"."Mime-Version: 1.0\nContent-Type: text/plain; charset={$data['charset']}\nContent-Transfer-Encoding: {$data['encoding']}\n",'-f'.$from->xEmail);
    if(!$suc) $suc = @mail($data['recepientMail']."\r\n",$data['subject']."\r\n",$data['body']."\r\n","From: {$data['FromName']} <{$data['From']}>"."\r\n"."Mime-Version: 1.0\nContent-Type: text/plain; charset={$data['charset']}\nContent-Transfer-Encoding: {$data['encoding']}\n");
    if(!$suc) $suc= mail($data['recepientMail'],stripslashes($data['subject']),stripslashes(str_replace("\r\n","\n",trim($data['body']))),"From: {$data['FromName']} <{$data['From']}>\nMime-Version: 1.0\nContent-Type: text/plain; charset={$data['charset']}\nContent-Transfer-Encoding: {$data['encoding']}\n");
    }
    $sql1 = substr($sql1, 0, -1);
    $sql2 = substr($sql2, 0, -1);
    $qry = "INSERT INTO {$wpdb->prefix}ar_gwa_log ($sql1) VALUES ($sql2)";
    $insertAttempt=$wpdb->query($qry);
    if ($insertAttempt===true) return true; else { return false; }
    }
    }

    function formatMsg($WP=NULL)
    {
    $unsubscribe = get_bloginfo('url').'?argwauid='.$this->lead['lID'] . '&argwaeml='.base64_encode($this->lead['lEmail']);
    $archivelink = get_bloginfo('url').'?aID='.$this->lead['lID'] . '&Email='.htmlentities($this->lead['lEmail']);
    $affiliate = 'http://www.freeautoresponder.biz/?/'.get_option('ar_gwa_aff_id');
    $ar_gwa_no_spam = get_option('ar_gwa_no_spam');
    if($ar_gwa_no_spam=='checked'){
    $ar_gwa_nospam_text = "\r\n\r\n".get_option('ar_gwa_nospam');
    } else {
    $ar_gwa_nospam_text = "\r\n\r\n".get_option('ar_gwa_footer_'.$this->lead['lLID']);
    }
    $affiliate_text_text = __("Free Autoresponder for Wordpress",'argwa')."\r\n$affiliate";
    $unsubscribe_text = __("Unsubscribe",'argwa')."\r\n$unsubscribe";
    $archivelink_text = __("View your message archive.",'argwa')."\r\n$archivelink";

    if($this->msg['mType'] == 'html') {
    if($ar_gwa_no_spam=='checked' && $ar_gwa_nospam_text != '') {
    $ar_gwa_nospam_text = preg_replace("/\r\n\r\n/",'<p>',$ar_gwa_nospam_text);
    $ar_gwa_nospam_text = preg_replace("/\r\n/",'<br>',$ar_gwa_nospam_text);
    }
    $affiliate_text = '<a href="'.$affiliate.'">'.__("Free Autoresponder for Wordpress",'argwa').'</a>';
    $unsubscribe = '<a href="'.$unsubscribe.'">'.__("Unsubscribe",'argwa' ).'</a>';
    $archivelink = '<a href="'.$archivelink.'">'.__("View your message archive.",'argwa').'</a>';
    } else {
    $affiliate_text = __("Free Autoresponder for Wordpress",'argwa')."\r\n$affiliate";
    $unsubscribe = __("Unsubscribe",'argwa')."\r\n$unsubscribe";
    $archivelink = __("View your message archive.",'argwa')."\r\n$archivelink";
    }

    if($WP==1) {
    $unsubscribe = "\n\n".__('Sent as part of your blog membership at','argwa').' '.get_bloginfo('name').".\n\n";
    $this->msg['mBody'] = str_replace('<?Name?>', $this->lead['display_name'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Name?>', $this->lead['display_name'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('<?Name?>', $this->lead['display_name'], $this->msg['mSubject']);
    $this->msg['mBody'] = str_replace('<?Email?>', $this->lead['user_email'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Email?>', $this->lead['user_email'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('<?Email?>', $this->lead['user_email'], $this->msg['mSubject']);
    } else {
    $this->msg['mBody'] = str_replace('<?Name?>', $this->lead['lName'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Name?>', $this->lead['lName'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('<?Name?>', $this->lead['lName'], $this->msg['mSubject']);
    $this->msg['mBody'] = str_replace('<?Email?>', $this->lead['lEmail'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Email?>', $this->lead['lEmail'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('<?Email?>', $this->lead['lEmail'], $this->msg['mSubject']);
    }
    $this->msg['mBody'] = str_replace('<?Unsubscribe?>', $unsubscribe, $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Unsubscribe?>', $unsubscribe, $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Archive?>', $archivelink, $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Archive?>', $archivelink, $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Field1?>', $this->lead['lField1'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Field1?>', $this->lead['lField1'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Field2?>', $this->lead['lField2'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Field2?>', $this->lead['lField2'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Field3?>', $this->lead['lField3'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Field3?>', $this->lead['lField3'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Field4?>', $this->lead['lField4'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Field4?>', $this->lead['lField4'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Field5?>', $this->lead['lField5'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('<?Field5?>', $this->lead['lField5'], $this->msg['mBodyAlt']);
    //For html emails composed in tinymce
    if($WP==1) {
    $this->msg['mBody'] = str_replace('&lt;?Name?&gt;', $this->lead['display_name'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Name?&gt;', $this->lead['display_name'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('&lt;?Name?&gt;', $this->lead['display_name'], $this->msg['mSubject']);
    $this->msg['mBody'] = str_replace('&lt;?Email?&gt;', $this->lead['user_email'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Email?&gt;', $this->lead['user_email'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('&lt;?Email?&gt;', $this->lead['user_email'], $this->msg['mSubject']);
    } else {
    $this->msg['mBody'] = str_replace('&lt;?Name?&gt;', $this->lead['lName'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Name?&gt;', $this->lead['lName'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('&lt;?Name?&gt;', $this->lead['lName'], $this->msg['mSubject']);
    $this->msg['mBody'] = str_replace('&lt;?Email?&gt;', $this->lead['lEmail'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Email?&gt;', $this->lead['lEmail'], $this->msg['mBodyAlt']);
    $this->msg['mSubject'] = str_replace('&lt;?Email?&gt;', $this->lead['lEmail'], $this->msg['mSubject']);
    }
    $this->msg['mBody'] = str_replace('&lt;?Unsubscribe?&gt;', $unsubscribe, $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Unsubscribe?&gt;', $unsubscribe, $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Archive?&gt;', $archivelink, $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Archive?&gt;', $archivelink, $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Field1?&gt;', $this->lead['lField1'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Field1?&gt;', $this->lead['lField1'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Field2?&gt;', $this->lead['lField2'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Field2?&gt;', $this->lead['lField2'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Field3?&gt;', $this->lead['lField3'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Field3?&gt;', $this->lead['lField3'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Field4?&gt;', $this->lead['lField4'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Field4?&gt;', $this->lead['lField4'], $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('&lt;?Field5?&gt;', $this->lead['lField5'], $this->msg['mBody']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Field5?&gt;', $this->lead['lField5'], $this->msg['mBodyAlt']);

    if(!class_exists('ar_gwa_user_edit') && file_exists(dirname(__FILE__).'/ar_gwa_user_edit.php')) include_once(dirname(__FILE__).'/ar_gwa_user_edit.php');
    if(class_exists('ar_gwa_user_edit') && $uca = new ar_gwa_user_edit($this->lead['lID'])){
    $this->msg['mBodyAlt'] = str_replace('<?Update?>',$uca->sendEditLink('text'), $this->msg['mBodyAlt']);
    $this->msg['mBodyAlt'] = str_replace('&lt;?Update?&gt;',$uca->sendEditLink('text'), $this->msg['mBodyAlt']);
    $this->msg['mBody'] = str_replace('<?Update?>',$uca->sendEditLink($this->msg['mType']), $this->msg['mBody']);
    $this->msg['mBody'] = str_replace('&lt;?Update?&gt;',$uca->sendEditLink($this->msg['mType']), $this->msg['mBody']);
    }

    if($this->msg['mType'] == 'html') { $lb = '<br /><br />'; } else { $lb ="\r\n\r\n"; }
    if(isset($ar_gwa_nospam_text) && $ar_gwa_nospam_text != '') {
    $this->msg['mBody'] .= $ar_gwa_nospam_text.$lb;
    $this->msg['mBodyAlt'] .= $ar_gwa_nospam_text."\r\n\r\n";
    }
    if(get_option('ar_gwa_addsub_'.$this->lead['lID'])!='') {
    $this->msg['mBody'] .= $unsubscribe.$lb;
    $this->msg['mBodyAlt'] .= $unsubscribe_text."\r\n\r\n";
    }
    if(get_option('ar_gwa_cb_'.$this->lead['lLID'])=='checked'){
    $this->msg['mBody'] .= $affiliate_text.$lb;
    $this->msg['mBodyAlt'] .= $affiliate_text_text."\r\n\r\n";
    }
    }
    }

    function argwa_show_page() {
    global $wpdb,$my_argwa_metabox_plugin; $statusBox = $my_argwa_metabox_plugin->statusBox(); $ofs = ((int)get_option('gmt_offset'))*60*60; $tim = time(); $tls = $wpdb->get_var("SELECT COUNT(lID) as ccnt FROM ".$wpdb->prefix."ar_gwa_leads WHERE lCnf=1");?>
    <style type="text/css">.argwahelp, .argwahelp2 {float: right;width:16px;height:16px;}</style>
    <div id="argwa-metaboxes-general" class="wrap"><?php screen_icon('options-general');?><h2>ARGWA Free Autoresponder v<?php echo $my_argwa_metabox_plugin->gwa_version_tag;?></h2><?php if($msg = get_option('argwa_error')) $my_argwa_metabox_plugin->argwa_show_error($msg);?><form id="admin_post_php" action="admin-post.php" method="post"><?php wp_nonce_field('argwa-metaboxes-general'); ?>
    <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?><?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?><input type="hidden" name="action" value="save_argwa_metaboxes_general" /><div id="poststuff" class="metabox-holder has-right-sidebar"><div id="side-info-column" class="inner-sidebar"><?php do_meta_boxes($my_argwa_metabox_plugin->pagehook, 'side', $data); ?></div>
    <div id="post-body" class="has-sidebar">
    <div id="post-body-content" class="has-sidebar-content">
    <div class="postbox " id="argwa-metaboxes-contentbox-99">
    <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><p style="float:right;margin:0;text-align:right;"><?php _e("Current Time",'argwa'); echo ': '.date_i18n('l jS \of F Y h:i:s A',$tim+$ofs);?></p><p style="margin:0"><?php echo __("Total Active Leads",'argwa').': '.$tls.'</p>';?></h3>
    <div class="inside"><?php echo $statusBox;?>
    </div>
    </div>
    <div class="postbox " id="argwa-metaboxes-contentbox-1"><div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span><?php _e("Newsletter",'argwa');?>: <?php echo $wpdb->get_var("SELECT xName FROM ".$wpdb->prefix."ar_gwa_lists");?></span></h3><div class="inside"><?php $my_argwa_metabox_plugin->do_list_detail_box(1);?> <?php $my_argwa_metabox_plugin->do_list_messages_box(1);?> <?php $my_argwa_metabox_plugin->do_list_leads_box(1);?> <?php $my_argwa_metabox_plugin->do_list_form_box(1);?> <?php $my_argwa_metabox_plugin->do_list_confirm_msg(1);?> <?php $my_argwa_metabox_plugin->do_list_subscribe_box(1);?> <?php $my_argwa_metabox_plugin->do_list_confirm_box(1);?> <?php $my_argwa_metabox_plugin->do_list_unsubscribe_box(1);?> <?php $my_argwa_metabox_plugin->do_list_error_box(1);?></div></div><div id="dialog" title="Add / Edit Message : ARGWA Pro"><p align="center"><img src="<?php echo ARGWA_PLUGIN_URL;?>/images/progress-indicator-alpha.gif"></p></div>
    <p style="padding:10px;"><input type="checkbox" name="ar_gwa_delete_all" value="delete" <?php echo get_option('ar_gwa_delete');?>>&nbsp;<span style="color:red"><?php _e("GLOBAL DELETE",'argwa');?>:</span> <?php _e("Tick this checkbox to DELETE ALL DATA when plugin is next deactivated. Please be aware: <u>All plugin data will be lost.</u>",'argwa');?></p><p style="padding:10px;width:95%;text-align:left;"><input type="submit" value="<?php _e("Save Global Options",'argwa');?>" class="button" name="Submit"/></p></div></div><br class="clear"/></div></form></div>
    <script type="text/javascript">
    //<![CDATA[
    jQuery(document).ready( function($) {
    $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
    postboxes.add_postbox_toggles('<?php echo $my_argwa_metabox_plugin->pagehook; ?>');
    $('#argwa-metaboxes-formbox-1').addClass('closed');
    $('#argwa-metaboxes-confbox-1').addClass('closed');
    $('#argwa_ur1_ifr').css('height','128px');
    $('div#post-body-content').find('.ui-widget').delay(5000).hide('slow','swing');
    $("#admin_post_php").attr("action", "<?php echo get_admin_url();?>admin.php?page=argwa_page");
    //]]>
    });</script>
    <?php
    }

    function argwa_dashboard_alert() {
    $email = get_option('ar_gwa_from');
    if(strpos($email,"gmail") || strpos($email,"hotmail") || strpos($email,"yahoo")) {
    ?>
    <style type="text/css">
    .alert {
    background-color: #FFCCCC;
    border: 1px solid #FF0000;
    color: #000000;
    padding: 6px;
    display:none;
    }
    </style>
    <script type="text/javascript">
    jQuery(document).ready(function(){ //when page has fully loaded
    jQuery('h2:contains("ARGWA")').parent().prev().aft er('<div id="argwa-plugin-alert" class="alert"><b>ARGWA Alert:</b> Your From: address should not be your GMAIL / HOTMAIL / YAHOO email. It SHOULD BE on your domain like <b>admin@<?php echo $_SERVER['SERVER_NAME'];?></b> for best results.</div>');
    setTimeout("jQuery('#argwa-plugin-alert').fadeIn('slow');clearTimeout();",1000);
    });
    </script>
    <?
    }
    ?>
    <style type="text/css">
    .ui-widget-overlay {
    background-color: #000000;
    opacity: 0.6;
    <?php global $wp_version;
    if ( $wp_version < 3.9 ) {
    ?> z-index: 100 !important;<?php
    } else {
    ?> z-index: 0 !important;<?php
    }
    ?>}
    </style>
    <?php
    }
    class ARGWA_Widget extends WP_Widget {

    public function __construct() {
    parent::__construct(
    'WidgetARGWA', // Base ID
    'ARGWA Autoresponder', // Name
    array( 'description' => __( 'A Widget for ARGWA Subscription Form', 'argwa' ), ) // Args
    );
    }

    function widget($args, $instance) {
    extract($args);
    $style = $instance['style'] = 1;
    echo $before_widget;
    if(!empty($instance['style'])) {
    echo $before_title."Subscribe".$after_title;
    global $my_argwa_metabox_plugin;// = new argwa_metabox_plugin();
    echo $my_argwa_metabox_plugin->argwa_form_display($instance['style'],1);
    }
    echo $after_widget;
    }

    function update($new_instance, $old_instance) {
    $instance = $old_instance;
    $instance['style'] = $new_instance['style'];
    return $new_instance;
    }

    function form( $instance ) {
    global $wpdb;
    ?><p><label for="<?php echo $this->get_field_id( 'style' ); ?>"><?php _e('Newsletter to Display:', ''); ?></label><select id="<?php echo $this->get_field_id( 'style' ); ?>" name="<?php echo $this->get_field_name( 'style' ); ?> class="widefat" style="width:100%;"><?php echo '<option selected="selected" value="1">'.$wpdb->get_var("SELECT xName FROM ".$wpdb->prefix."ar_gwa_lists WHERE xID=1").'</option>';?></select></p><?php
    }
    }
    ?>
    {{ DiscussionBoard.errors[9947953].message }}

Trending Topics