0 Replies - 1109 Views - Last Post: 20 July 2013 - 04:58 PM

#1 ELF Builder   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 20-July 13

Help with javascript free Dual Action form submit

Posted 20 July 2013 - 04:58 PM

Hi everyone. Can you help me find a way to get my form submission to mail the sumbittion to my email address AND process the signup script at s.php?

Basicaly I've taken the opt-in signup form and added some fields to it which are going to be ignored by s.php in my autoresponder program but I would lie to receive those inputs (or easier, all inputs in my email which I am assuming wors via the "mailto" action.

I've read that it can be dome with javascript but if users have this off then it wont work. So, is there a script I can put in my HTML file that will have the form sumbit both to the s.php and to my email?

What do you reccomend?

The code in s.php is for my autoresponder program so I'd prefer not to alter it, but I would be happy to copy it into another file called s2.php and edit that for this case if you think that's appropriate. I'm including both my HTML and the s.php below. Any help you can offer is greatly appreciated.

Here is the code from my page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>index</title>

<meta http-equiv="imagetoolbar" content="false">

<style type="text/css">
<!--

#shell {
padding: 10;
margin: 10 200 auto;
margin-left: auto ;
margin-right: auto ;
border: 1px solid #e2e3de;
border-radius: 15px;
-webkit-border-radius: 15px;
background-color: #ffffff;
    margin: 0 auto;}

a:link {color: #0000ff;}
a:visited {color: #800080;}
a:active {color: #ff0000;}

body {
  margin: 0;
  height: 100%;
  width: 100%;
  background-color: #ffffff;
  min-width: 240px;
}

.main {
	    background: #fff;
	    padding: 0px 0 0px;
	    min-height: 300px;
		margin:0 20 auto;
	}

.ie7 body,
	.ie8 body {
	    min-width: 860px; /* media queries are not supported in ie7/8 without a polyfill */
	}
	.main {
	    background: #fff;
	    padding: 8px 0 60px;
	    min-height: 300px;
    width: 99%;
    margin: 0 auto;
	}
	
	.primevid {
display: block;
    margin:0 210 auto;
	width: 50%;
	}
	
	#video {
padding-bottom: 50px;
background: url('http://ascendancyconsulting.com/Landings/video%20shadow.png') 0 bottom no-repeat; }
	
.buybuttons {
display: block;
    margin:19 210 auto;
	display: block;
	width: 51%;
	}

.buy { vertical-align: top; margin-top:24px;}

img {
  border-width: 0;
  vertical-align: top;
}
.dfltt {
  font-family: 'Times New Roman';
  font-size: 12px;
  font-weight: normal;
  font-style: normal;
  text-decoration: none;
  text-align: left;
  color: #000000;
}
.lalign {
  position: relative;
  text-align: left;
}
.ralign {
  position: relative;
  text-align: right;
}
.calign {
  position: relative;
  text-align: center;
}
.jalign {
  position: relative;
  text-align: justify;
}
#Oobj6 {
  margin-top:0px;
  background: #000000;
  font-size: 10px;
  z-index: 1;
  width: 100%;
  height: 15.70em;
}
img#Ggeo6 {
  width: 100%;
  height: 100%;
}
#Oobj1 {
  position: absolute;
  font-size: 10px;
  z-index: 2;
  left: 0.20em;
  top: 0.20em;
  width: 14.80em;
  height: 15.00em;
}
img#Ggeo1 {
  width: 100%;
  height: 100%;
}
#Oobj3 {
  background: #000000;
  position: absolute;
  font-size: 10px;
  z-index: 3;
  text-align: left;
  left: 15.40em;
  top: 3.20em;
  width: 53.80em;
  height: 5.30em;
}
img#Gtitle9 {
  width: 100%;
  height: 100%;
}
#Oobj4 {
  position: absolute;
  font-size: 10px;
  z-index: 4;
  text-align: left;
  left: 15.50em;
  top: 7.90em;
  width: 40.00em;
  height: 2.90em;
}
.txt0 {
  font-family: Tahoma, sans-serif;
  font-size: 19px;
  color: #ffffff;
}
.bold {font-weight: bold;}

/* GENERIC STYLES */
 
.typography * {
	font-family: Georgia, 'Times New Roman', Times, serif; 
}

/* PARAGRAPHS */

.typography p { 
 	color: #666;
 	line-height: 1.25em;
 	font-size: 0.9em;
	margin: 0 0 18px 0;
}


/* QUOTES */

.typography blockquote {
	margin: 10px;
	font-size: 1.4em;
	color: #777;
	font-style: italic;
}	
.typography q {
	display:block;
	font-size: 0.8em;
	margin: 1em 1em;
	padding: 0.5em;
	border: 1px #ccc solid;
}


/* LINKS */

.typography a { 
 	text-decoration: underline; 
	color: #4ea3d7;
}
	.typography a:hover { 
 		text-decoration: underline;
		color: #0099FF;
	}

	/* LINK ICONS - shows type of file */
	
	.typography a[href$=".pdf"],
	.typography a[href$=".PDF"],
	.typography a.pdf {
		padding: 2px;
		padding-left: 20px;
		background: url(../images/icons/page_white_acrobat.png) no-repeat left center;
	}
	.typography a[href$=".doc"],
	.typography a[href$=".DOC"],
	.typography a.doc {
		padding: 2px;
		padding-left: 20px;
		background: url(../images/icons/page_word.png) no-repeat left center;
	}
	.typography a[href$=".xls"],
	.typography a[href$=".XLS"],
	.typography a.xls {
		padding: 2px;
		padding-left: 20px;
		background: url(../images/icons/page_excel.png) no-repeat left center;
	}
	.typography a[href$=".gz"],
	.typography a[href$=".GZ"],
	.typography a[href$=".gzip"],
	.typography a[href$=".GZIP"],
	.typography a[href$=".zip"],
	.typography a[href$=".ZIP"],
	.typography a.archive {
		padding: 2px;
		padding-left: 20px;
		background: url(../images/icons/page_white_zip.png) no-repeat left center;
	}
	.typography a[href$=".exe"],
	.typography a[href$=".EXE"],
	.typography a.application {
		padding: 2px;
		padding-left: 20px;
		background: url(../images/icons/application.png) no-repeat left center;
	}

/* LIST STYLES */

.typography ul, 
.typography ol {
	margin: 0 0 18px 24px;
	color: #666;
}
	.typography li {
		margin: 5px 10px;
		font-size: 0.85em;
	}
		.typography li li {
			font-size: 0.9em;
			margin: 10px 5px;
		}
		
		
/* HEADER STYLES  */

.typography h1,
.typography h2 { 
	color: #4EA3D7; 
	margin: 0 0 18px 0;
	font-weight: 300;
	font-family: Georgia, 'Times New Roman', Times, serif; 
}
	#Layout .typography h1,
	#Layout .typography h2  {
	}
.typography h1 {
	display: block;
    margin:auto;
	font-size: 3em;
	line-height: 120%;
	/*width: 50%;*/
	text-align: center;
}
.typography h2 { 
 	font-size: 1em;
	line-height: 120%;
}	
.typography h3 {
	color: #222;
	margin: 0 0 18px 0;
	font-weight: 300;
	clear: both;
	font-size: 18px;
}
.typography h4 {
	font-size: 16px;
	color: #666;
	width: 95%;
	font-weight: 300;
	line-height: 18px;
	border-bottom: 1px solid #666;
	margin: 16px 0 16px 0;
	padding-bottom: 3px;
}
.typography h5 {
	font-size: 14px;
	color: #222;
	font-weight: 700;
	margin: 0 0 12px 0;
}
.typography h6 {
	font-size: 13px;
	color: #555;
	line-height: 1.4em;
	margin: 0 0 12px 0;
}


/* PRE STYLES  */	

.typography pre {
	font-family:"Courier New",Courier;
	display:block;
	font-size:1.2em;
	margin:2em 5em;
	padding:0.5em;
	border:1px #ccc solid;
	background:#eee;;
}

-->
</style>
</head> 

<body>
<header>
<div id="Oobj6">
</div>

<div id="Oobj1">
<img id="Ggeo1" src="./image/logo.png" alt="">
</div>

<div id="Oobj3">
<img id="Gtitle9" src="./geometry/obj3title9pg1p5.png" alt=""></div>

<div id="Oobj4">
<div id="Grtf10" class="dfltt">
<span class ="txt0"><span class ="bold">Rise &amp; Overcome</span><br>
</span></div>
</div>
</header>

<div class="content">
		<div class="typography"><h1>Business Growth Consulting Serivices:</h1></div>
	
		<div id="shell" style="display: block; ">
	<div style="float: left; margin-left: 10px;"><img src="30DayGuarantee.png">
	<br>
	<img src="SatisfactionGuaranteedBadge.png"></div>
			<center>
			<table cellspacing="10" bgcolor="#CCCCCC" style="border: 1px solid #e2e3de;
border-radius: 15px;
-webkit-border-radius: 15px;"><tr><td>
			<form action="http://ascendancyconsulting.com/IResponder/s.php" method=GET>
			<strong><font color="#000066">Full Name: </font></strong>  First: <input type="text" name="f" style="background-color : #FFFFFF" size=11 maxlength=40> 
			Last:<input type="text" name="l" style="background-color : #FFFFFF" size=11 maxlength=40>
			<br>
			<strong><font color="#000066">Email address:</font></strong>
			<input type="text" name="e" style="background-color : #FFFFFF" size=20 maxlength=50><br>
			<strong><font color="#000066">Your Best Phone Number:</font></strong><input type="text" name="f" style="background-color : #FFFFFF" size=20 maxlength=20><br>
			<strong><font color="#000066">Business Website (if any):</font></strong><input type="text" name="l" style="background-color : #FFFFFF" size=20 maxlength=40><br>
			<strong><font color="#000066">What are you looking for? (400 words or less):</font></strong><input type="text" name="e" style="background-color : #FFFFFF" size=50 maxlength=1000><br>
			<strong><font color="#000066">Best times to call you for your consultation:</font></strong><input type="text" name="e" style="background-color : #FFFFFF" size=25 maxlength=150><br>
			<input type="hidden" name="r" value="6">
			<input type="hidden" name="a" value="sub">
			<input type="hidden" name="ref" value="none">
			<font color="#003300">Can you see images in your emails? (HTML): <input type="RADIO" name="h" value="1">Yes  
			<input type="RADIO" name="h" value="0" checked="checked">No<br><input type="image" src="http://ascendancyconsulting.com/Landings/Apply%20Now.png" name="submit" value="Submit">
			</font></form>
			</td></tr></table>
			</center>
		</div>
		</div>

</body> 
</html> 





s.php code:

<?php 
# ------------------------------------------------
# License and copyright:
# See license.txt for license information.
# ------------------------------------------------

include('config.php');

# -------------------------------------------------------------------

function AddCustomFields() {
   global $Email_Address, $Responder_ID;
   global $FirstName, $LastName, $DB_LinkID;

   $CustomFieldsArray = GetFieldNames('InfResp_customfields');
   $CustomFieldsExist = FALSE;
   foreach ($CustomFieldsArray as $key => $value) {
      $blah = "cf_".$value;
      $reqblah = trim($_REQUEST[$blah]);
      if (!(Empty($reqblah))) {
          $CustomFieldsArray[$value] = MakeSafe($reqblah);
          $CustomFieldsExist = TRUE;
      }
   }

   # Any custom fields?
   if ($CustomFieldsExist == TRUE) {
      #------------- Mandatory fields checking ------------------
      # if (empty($CustomFieldsArray['blah'])) { die('Error Message'); }
      #----------------------------------------------------------

      # --- Custom code ---
      $Fullname = "$FirstName $LastName";
      $CustomFieldsArray['full_name'] = $Fullname;
      # -------------------

      # Set static data
      $CustomFieldsArray['email_attached'] = $Email_Address;
      $CustomFieldsArray['resp_attached']  = $Responder_ID;
      unset($CustomFieldsArray['fieldID']);
      unset($CustomFieldsArray['user_attached']);

      # Delete any old data
      $query = "SELECT * FROM InfResp_customfields WHERE email_attached = '$Email_Address' AND resp_attached = '$Responder_ID'";
      $result = mysql_query($query) or die("Invalid query: " . mysql_error());
      if (mysql_num_rows($result) > 0) {
          $query = "DELETE FROM InfResp_customfields WHERE email_attached = '$Email_Address' AND resp_attached = '$Responder_ID'";
          $result = mysql_query($query) or die("Invalid query: " . mysql_error());
      }

      # Insert new data
      DB_Insert_Array("InfResp_customfields", $CustomFieldsArray);
   }
}

# -------------------------------------------------------------------

# Process inputs
if ($_REQUEST['s'] == "1") { $SilentMode = 1; }
   else { $SilentMode = 0; }

# Process input
$Email_Address  = rawurldecode(trim($_REQUEST['e']));
$Email_Address  = str_replace(">","",$Email_Address);
$Email_Address  = str_replace("<","",$Email_Address);
$Email_Address  = str_replace("\\","",$Email_Address);
$Email_Address  = str_replace('/',"",$Email_Address);
$Email_Address  = str_replace('..',"",$Email_Address);
$Email_Address  = str_replace('|',"",$Email_Address);
$Email_Address  = stripnl(MakeSafe($Email_Address));
$Confirm_String = MakeSafe($_REQUEST['c']);
$Subscriber_ID  = MakeSafe($_REQUEST['sub_ID']);
$HandleHTML     = MakeSafe($_REQUEST['h']);
$ReferralSrc    = MakeSafe($_REQUEST['ref']);
$IPaddy         = $_SERVER['REMOTE_ADDR'];

# Grab the name
if (isEmpty($_REQUEST['n'])) {
   $FirstName      = MakeSafe($_REQUEST['f']);
   $LastName       = MakeSafe($_REQUEST['l']);
}
else {
   $FullName       = MakeSafe($_REQUEST['n']);
   $names          = explode(' ',$FullName);
   $FirstName      = $names[0];
   $LastName = '';
   for ($k=1; $k<=(count($names)-1); $k++) {
       $LastName = $LastName . " " . $names[$k];
   }
   $LastName = trim($LastName);
}

# Grab the action var
if (isEmpty($_REQUEST['a'])) {
   $action = strtolower(MakeSafe($_REQUEST['action']));
}
else {
   $action = strtolower(MakeSafe($_REQUEST['a']));
}

# Grab responder ID
if (isset($_REQUEST['r'])) {
   $Responder_ID = MakeSafe($_REQUEST['r']);
}
else {
   $Responder_ID = MakeSafe($_REQUEST['r_ID']);
}

# Bounds checking
if (!(is_numeric($Responder_ID)))  { $Responder_ID = 0; }
if (!(is_numeric($Subscriber_ID))) { $Subscriber_ID = 0; }
if ($HandleHTML != "1") { $HandleHTML = "0"; }

# Actions from admin.php
if (($action == "resend_unsub_conf") || ($action == "resend_sub_conf")) {
     # Pull info
     if (!(ResponderExists($Responder_ID))) { admin_redirect(); }
     GetResponderInfo();
     if ((GetSubscriberInfo($Subscriber_ID)) == FALSE) { admin_redirect(); }

     # Open template
     if ($SilentMode != 1) {
          include('templates/open.page.php');
     }

     # Handle the action
     if ($action == "resend_sub_conf") {
          SendMessageTemplate('templates/subscribe.confirm.txt');
          if ($SilentMode != 1) {
               print "<br />Subscription confirmation message sent!<br />\n";
          }
     }
     elseif ($action == "resend_unsub_conf") {
          SendMessageTemplate('templates/unsubscribe.confirm.txt');
          if ($SilentMode != 1) {
               print "<br />Unsubscribe confirmation message sent!<br />\n";
          }
     }

     # Back to admin button
     $return_action = 'sub_edit';
     if ($SilentMode != 1) {
          include('templates/admin_button.subhandler.php');
     }

     # Close template
     if ($SilentMode != 1) {
          copyright();
          include('templates/close.page.php');
     }
     die();
}

# Is there a confirm string?
if (!(isEmpty($Confirm_String))) {
     # Is a sub or an unsub code?
     $type = strtolower(substr($Confirm_String, 0, 1));
     if (($type == "s") || ($type == "u")) {
          # Verify the code
          $code = substr($Confirm_String, 1, (strlen($Confirm_String)-1));
          $query = "SELECT * FROM InfResp_subscribers WHERE UniqueCode = '$code'";
          $result = mysql_query($query) or die("Invalid query: " . mysql_error());
          if (mysql_num_rows($result) < 1) {
               # Invalid code. Print it!
               if ($SilentMode != 1) {
                    include('templates/open.page.php');
                    include('templates/invalid_code.subhandler.php');
                    copyright();
                    include('templates/close.page.php');
               }
               die();
          }

          # Grab the subscriber data
          $result_data = mysql_fetch_assoc($result);
          $DB_SubscriberID    = $result_data['SubscriberID'];
          $DB_ResponderID     = $result_data['ResponderID'];
          $DB_SentMsgs        = $result_data['SentMsgs'];
          $DB_EmailAddress    = $result_data['EmailAddress'];
          $DB_TimeJoined      = $result_data['TimeJoined'];
          $DB_Real_TimeJoined = $result_data['Real_TimeJoined'];
          $CanReceiveHTML     = $result_data['CanReceiveHTML'];
          $DB_LastActivity    = $result_data['LastActivity'];
          $DB_FirstName       = $result_data['FirstName'];
          $DB_LastName        = $result_data['LastName'];
          $DB_IPaddy          = $result_data['IP_Addy'];
          $DB_ReferralSource  = $result_data['ReferralSource'];
          $DB_UniqueCode      = $result_data['UniqueCode'];
          $DB_Confirmed       = $result_data['Confirmed'];

          # Grab the relevant responder data
          $Responder_ID = $DB_ResponderID;
          if (!(ResponderExists($Responder_ID))) { 
               # Invalid code. Print it!
               if ($SilentMode != 1) {
                    include('templates/open.page.php');
                    include('templates/invalid_code.subhandler.php');
                    copyright();
                    include('templates/close.page.php');
               }
               die();
          }
          GetResponderInfo();

          # Emails, DB and redir/template
          if ($type == "s") {
               # Do DB update
               $Set_LastActivity = time();
               $query = "UPDATE InfResp_subscribers SET LastActivity = '$Set_LastActivity', TimeJoined = '$Set_LastActivity', Real_TimeJoined = '$Set_LastActivity', Confirmed = '1' WHERE SubscriberID = '$DB_SubscriberID'";
               $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());

               # Handle custom fields
               AddCustomFields();

               # Send mail
               SendMessageTemplate('templates/subscribe.complete.txt');
               if ($DB_NotifyOnSub == "1") {
                    SendMessageTemplate('templates/new_subscriber.notify.txt',$DB_OwnerEmail,$DB_OwnerEmail);
               }

               # Autocall sendmails on subscribe?
               if ($config['autocall_sendmails'] == "1") {
                    $silent = TRUE;
                    include('sendmails.php');
               }

               # Redir or template
               if ((trim($DB_OptInRedir)) == "") {
                    # Display the page
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         include('templates/sub_complete.subhandler.php');
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
               else {
                    if ($SilentMode != 1) {
                         header("Location: $DB_OptInRedir");
                         print "<br>\n";
                         print "Now redirecting you to a new page...<br>\n";
                         print "<br>\n";
                         print "If your browser doesn't support redirects then you'll need to <A HREF=\"$DB_OptInRedir\">click here.</A><br>\n";
                         print "<br>\n";
                    }
                    die();
               }
          }
          elseif ($type == "u") {
               # Send mail
               SendMessageTemplate('templates/unsubscribe.complete.txt');
               if ($DB_NotifyOnSub == "1") {
                    SendMessageTemplate('templates/subscriber_left.notify.txt',$DB_OwnerEmail,$DB_OwnerEmail);
               }

               # Delete from DB
               $query = "DELETE FROM InfResp_subscribers WHERE SubscriberID = '$DB_SubscriberID'";
               $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
               $query = "DELETE FROM InfResp_customfields WHERE user_attached = '$DB_SubscriberID'";
               $result = mysql_query($query) or die("Invalid query: " . mysql_error());
 
               # Redirect or template
               if ((trim($DB_OptOutRedir)) == "") {
                    # Display the page
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         include('templates/unsub_complete.subhandler.php');
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
               else {
                    if ($SilentMode != 1) {
                         header("Location: $DB_OptOutRedir");
                         print "<br>\n";
                         print "Now redirecting you to a new page...<br>\n";
                         print "<br>\n";
                         print "If your browser doesn't support redirects then you'll need to <A HREF=\"$DB_OptOutRedir\">click here.</A><br>\n";
                         print "<br>\n";
                    }
                    die();
               }
          }
     }
     else {
          # Invalid code. Print it!
          if ($SilentMode != 1) {
               include('templates/open.page.php');
               include('templates/invalid_code.subhandler.php');
               copyright();
               include('templates/close.page.php');
          }
          die();
     }
}
else {
     # if ($action == "unsub") {
     #      # Get user and responder info
     #      if ((GetSubscriberInfo($Subscriber_ID)) == FALSE) {
     #           if ($SilentMode != 1) {
     #                include('templates/open.page.php');
     #                include('templates/invalid_action.subhandler.php');
     #                copyright();
     #                include('templates/close.page.php');
     #           }
     #           die();
     #      }
     #      $Responder_ID = $DB_ResponderID;
     #      if (!(ResponderExists($Responder_ID))) {
     #           if ($SilentMode != 1) {
     #                include('templates/open.page.php');
     #                include('templates/invalid_action.subhandler.php');
     #                copyright();
     #                include('templates/close.page.php');
     #           }
     #           die();
     #      }
     #      GetResponderInfo();
     #
     #      # Send confirmation msg
     #      SendMessageTemplate('templates/unsubscribe.confirm.txt');
     #
     #      # Display from the DB or the template
     #      if ((trim($DB_OptOutDisplay)) == "") {
     #           # Display the template
     #           if ($SilentMode != 1) {
     #                include('templates/open.page.php');
     #                include('templates/unsub_confirm.subhandler.php');
     #                copyright();
     #                include('templates/close.page.php');
     #           }
     #           die();
     #      }
     #      else {
     #           # Display from the DB
     #           if ($SilentMode != 1) {
     #                include('templates/open.page.php');
     #                print $DB_OptOutDisplay;
     #                copyright();
     #                include('templates/close.page.php');
     #           }
     #           die();
     #      }
     # }
     if (($action == "sub") || ($action == "subscribe") || ($action == "s")) {
          # Check the email address format
          if (!(isEmail($Email_Address))) {
               if ($SilentMode != 1) {
                    include('templates/open.page.php');
                    include('templates/invalid_email.subhandler.php');
                    copyright();
                    include('templates/close.page.php');
               }
               die();
          }

          # Is the email address blacklisted?
          if (isInBlacklist($Email_Address)) {
               if ($SilentMode != 1) {
                    include('templates/open.page.php');
                    include('templates/blacklisted.subhandler.php');
                    copyright();
                    include('templates/close.page.php');
               }
               die();
          }

          # Get responder info.
          if (!(ResponderExists($Responder_ID))) { 
               # Invalid code. Print it!
               if ($SilentMode != 1) {
                    include('templates/open.page.php');
                    include('templates/invalid_code.subhandler.php');
                    copyright();
                    include('templates/close.page.php');
               }
               die();
          }
          GetResponderInfo();

          # Is the email already on this responder?
          $query = "SELECT * FROM InfResp_subscribers WHERE ResponderID = '$Responder_ID' AND EmailAddress = '$Email_Address'";
          $result = mysql_query($query) or die("Invalid query: " . mysql_error());
          if (mysql_num_rows($result) > 0) {
               # Yes, it is.
               $result_data = mysql_fetch_assoc($result);
               $DB_SubscriberID    = $result_data['SubscriberID'];
               $DB_ResponderID     = $result_data['ResponderID'];
               $DB_SentMsgs        = $result_data['SentMsgs'];
               $DB_EmailAddress    = $result_data['EmailAddress'];
               $DB_TimeJoined      = $result_data['TimeJoined'];
               $DB_Real_TimeJoined = $result_data['Real_TimeJoined'];
               $CanReceiveHTML     = $result_data['CanReceiveHTML'];
               $DB_LastActivity    = $result_data['LastActivity'];
               $DB_FirstName       = $result_data['FirstName'];
               $DB_LastName        = $result_data['LastName'];
               $DB_IPaddy          = $result_data['IP_Addy'];
               $DB_ReferralSource  = $result_data['ReferralSource'];
               $DB_UniqueCode      = $result_data['UniqueCode'];
               $DB_Confirmed       = $result_data['Confirmed'];

               # Are they confirmed?
               if ($DB_Confirmed == "1") {
                    # Yes, display the error page.
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         include('templates/already_subscribed.subhandler.php');
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
               else {
                    # Send confirmation msg
                    SendMessageTemplate('templates/subscribe.confirm.txt');

                    # Display from the DB or the template
                    if ((trim($DB_OptInDisplay)) == "") {
                         # Display the template
                         if ($SilentMode != 1) {
                              include('templates/open.page.php');
                              include('templates/sub_confirm.subhandler.php');
                              copyright();
                              include('templates/close.page.php');
                         }
                         die();
                    }
                    else {
                         # Display from the DB
                         if ($SilentMode != 1) {
                              include('templates/open.page.php');
                              print $DB_OptInDisplay;
                              copyright();
                              include('templates/close.page.php');
                         }
                         die();
                    }
               }
          }

          # They aren't already subscribed, let's proceed...
          $DB_ResponderID     = $Responder_ID;
          $DB_SentMsgs        = "";
          $DB_EmailAddress    = $Email_Address;
          $DB_TimeJoined      = time();
          $DB_Real_TimeJoined = time();
          $CanReceiveHTML     = $HandleHTML;
          $DB_LastActivity    = time();
          $DB_FirstName       = $FirstName;
          $DB_LastName        = $LastName;
          $DB_IPaddy          = $IPaddy;
          $DB_ReferralSource  = $ReferralSrc;
          $DB_UniqueCode      = generate_unique_code();
          $DB_Confirmed       = "0";

          if ($DB_OptMethod == "Double") {
               # Add a non-confirmed row to the DB
               $query = "INSERT INTO InfResp_subscribers (ResponderID, SentMsgs, EmailAddress, TimeJoined, Real_TimeJoined, CanReceiveHTML, LastActivity, FirstName, LastName, IP_Addy, ReferralSource, UniqueCode, Confirmed)
                         VALUES('$DB_ResponderID','$DB_SentMsgs', '$DB_EmailAddress', '$DB_TimeJoined', '$DB_Real_TimeJoined', '$CanReceiveHTML', '$DB_LastActivity', '$DB_FirstName', '$DB_LastName', '$DB_IPaddy', '$DB_ReferralSource', '$DB_UniqueCode', '$DB_Confirmed')";
               $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
               $DB_SubscriberID = mysql_insert_id();
               
               # Send confirmation msg
               SendMessageTemplate('templates/subscribe.confirm.txt');

               # Display from the DB or the template
               if ((trim($DB_OptInDisplay)) == "") {
                    # Display the template
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         include('templates/sub_confirm.subhandler.php');
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
               else {
                    # Display from the DB
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         print $DB_OptInDisplay;
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
          }
          else {
               # Add a confirmed row to the DB
               $DB_Confirmed = "1";
               $query = "INSERT INTO InfResp_subscribers (ResponderID, SentMsgs, EmailAddress, TimeJoined, Real_TimeJoined, CanReceiveHTML, LastActivity, FirstName, LastName, IP_Addy, ReferralSource, UniqueCode, Confirmed)
                         VALUES('$DB_ResponderID','$DB_SentMsgs', '$DB_EmailAddress', '$DB_TimeJoined', '$DB_Real_TimeJoined', '$CanReceiveHTML', '$DB_LastActivity', '$DB_FirstName', '$DB_LastName', '$DB_IPaddy', '$DB_ReferralSource', '$DB_UniqueCode', '$DB_Confirmed')";
               $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
               $DB_SubscriberID = mysql_insert_id();

               # Handle custom fields
               AddCustomFields();

               # Send mail and notify
               SendMessageTemplate('templates/subscribe.complete.txt');
               if ($DB_NotifyOnSub == "1") {
                    SendMessageTemplate('templates/new_subscriber.notify.txt',$DB_OwnerEmail,$DB_OwnerEmail);
               }

               # Autocall sendmails on subscribe?
               if ($config['autocall_sendmails'] == "1") {
                    $silent = TRUE;
                    include('sendmails.php');
               }

               # Template or redirect
               if ((trim($DB_OptInRedir)) == "") {
                    # Display the page
                    if ($SilentMode != 1) {
                         include('templates/open.page.php');
                         include('templates/sub_complete.subhandler.php');
                         copyright();
                         include('templates/close.page.php');
                    }
                    die();
               }
               else {
                    if ($SilentMode != 1) {
                         header("Location: $DB_OptInRedir");
                         print "<br>\n";
                         print "Now redirecting you to a new page...<br>\n";
                         print "<br>\n";
                         print "If your browser doesn't support redirects then you'll need to <A HREF=\"$DB_OptInRedir\">click here.</A><br>\n";
                         print "<br>\n";
                    }
                    die();
               }
          }
     }
     else {
          if ($SilentMode != 1) {
               include('templates/open.page.php');
               include('templates/invalid_action.subhandler.php');
               copyright();
               include('templates/close.page.php');
          }
          die();
     }
}

DB_disconnect();
?>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1