Spiffs up contact_and_edit, adding error correction and required waiver.

1). Next step will be an opt-in/out to mailman.
2). Originally this program was using google lists, but there are too many steps for users involved.
This commit is contained in:
Jonathan Rosenbaum
2015-02-11 01:55:38 +00:00
parent 8f8e1623df
commit 7b64d0c494
12 changed files with 268 additions and 126 deletions
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<p>An confirmation message has been sent to your email address to join our newsletter list.</p>
<p>You will be redirected to the sign-in sheet in a moment. </p>
</body>
</html>
@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script>
function getArgs() {
var args = new Object();
var query = location.search.substring(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf("=");
if (pos == -1) continue;
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
args[argname] = unescape(value);
}
return args;
}
var args = getArgs();
var google_link = "http://groups.google.com/group/yellowbike-newsletter/boxsubscribe?email=" + args.email;
var frameset_def = '<frameset rows="200,600" cols="*" framespacing="0" frameborder="no" border="0">/n<frame src="contact_add_edit_confirmation.html" name="mainFrame" id="mainFrame" title="mainFrame" />/n<frame src="' + google_link + '" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />/n</frameset>';
document.write(frameset_def);
</script>
<noframes><body>
</body>
</noframes></html>
@@ -0,0 +1,18 @@
<?php
$email = $_GET['email'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<frameset rows="100,600" cols="*" framespacing="0" frameborder="no" border="0">
<frame src="contact_add_edit_confirmation.html" name="mainFrame" id="mainFrame" title="mainFrame" />
<frame src="http://groups.google.com/group/yellowbike-newsletter/boxsubscribe?email=<?php echo $email; ?>" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>
@@ -0,0 +1,63 @@
<?php
//This function redirects the Log to the Welcome Page
function redirect($sec_delay){
$sec_delay = $sec_delay* 1000;
echo <<<EOD
<SCRIPT language="JavaScript">
<!--
function getgoing()
{
top.location="http://www.ybdb.austinyellowbike.org/shop_log.php?" + location.search.substring(1);
}
setTimeout('getgoing()',$sec_delay);
//-->
</SCRIPT>
EOD;
}
?>
<?php
if (isset($_GET['email'])) {
$email = $_GET['email'];
} else {
$email = -1;
}
$editFormAction = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<?php
//Welcome page redirects
redirect(15); //Always redirect in 60 seconds on this page
?>
<link href="css_yb_standard.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" align="center" cellpadding="1" cellspacing="0" class="yb_standardCENTER">
<tr>
<td height="900" valign="top"><p class="yb_standardCENTERred">First-time sign in almost complete </p>
<p>You have been sent an email to confirm your subscription to:</p>
<p><strong>The Yellow Bike Project - Monthly Newsletter </strong></p>
<p> To begin receiving the newsletter follow the instructions in the confirmation email. </p>
<p>&nbsp;</p>
<p>You will be redirected to the sign-in sheet in a moment. <span class="yb_standardCENTERred">Please sign in there. </span></p>
</td>
</tr>
</table>
<p>&nbsp;</p>
<IFRAME SRC="http://groups.google.com/group/yellowbike-newsletter/boxsubscribe?email=<?php echo $email;?>" WIDTH=760 HEIGHT=500>
</IFRAME>
<p>&nbsp;</p>
</body>
</html>
+180
View File
@@ -0,0 +1,180 @@
<?php
require_once('Connections/YBDB.php');
require_once('Connections/database_functions.php');
if($_GET['shop_id']>0){
$shop_id = $_GET['shop_id'];
} else {
$shop_id = current_shop_by_ip();
}
switch ($_GET['error']) {
case 'new_error_message': //this is a sample error message. insert error case here
$error_message = '';
break;
default:
$error_message = 'Enter or Update Contact Information - </span><span class="yb_standard"> Yellow Bike uses this information soely to support the project and it is kept entirely private. When we apply for grants it helps us to know a little bit about our shop users. <p>Thanks for supporting The Yellow Bike Project. </p> </span><span class="yb_heading3red">';
break;
}
$page_shop_log = PAGE_SHOP_LOG . "?shop_id=$shop_id";
if($_GET['contact_id'] == 'new_contact'){
//adds contact is new_contact is selected
$insertSQL = sprintf("INSERT INTO contacts (date_created) VALUES (%s)",
GetSQLValueString('current_time', "date"));
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset2 = "SELECT MAX(contact_id) as new_contact_id FROM contacts;";
$Recordset2 = mysql_query($query_Recordset2, $YBDB) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$contact_id = $row_Recordset2['new_contact_id'];
$contact_id_entry = 'new_contact';
mysql_free_result($Recordset2);
} elseif(isset($_GET['contact_id'])) {
//else contact_id is assigned from passed value
$contact_id = $_GET['contact_id'];
$contact_id_entry = $_GET['contact_id'];
} else {
$contact_id = -1;
$contact_id_entry = -1;
}
$editFormAction = $_SERVER['PHP_SELF'] . "?contact_id={$contact_id}&shop_id={$shop_id}";
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$updateSQL = sprintf("UPDATE contacts SET first_name=%s, middle_initial=%s, last_name=%s, email=%s, DOB=%s, receive_newsletter=%s, phone=%s, address1=%s, address2=%s, city=%s, `state`=%s, zip=%s, pass=ENCODE(%s,'yblcatx') WHERE contact_id=%s",
GetSQLValueString($_POST['first_name'], "text"),
GetSQLValueString($_POST['middle_initial'], "text"),
GetSQLValueString($_POST['last_name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['DOB'], "date"),
GetSQLValueString($_POST['list_yes_no'], "int"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['address1'], "text"),
GetSQLValueString($_POST['address2'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['zip'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['contact_id'], "int"));
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
if ($_POST['contact_id_entry'] == 'new_contact'){
//navigate back to shop that it came from
//if there is an email address submitted pass this to google groups signup. Otherwise redirect to shop log.
if ((strpos($_POST['email'], '@') > 0) && ($_POST['list_yes_no'] == 1)) {
$email = $_POST['email'];
$pagegoto = "contact_add_edit_confirmation_iframe.php" . "?shop_id={$shop_id}&new_user_id={$contact_id}&email=$email";
} else {
$pagegoto = PAGE_SHOP_LOG . "?shop_id={$shop_id}&new_user_id={$contact_id}";
}
header(sprintf("Location: %s", $pagegoto));
}
}
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset1 = "SELECT *, DECODE(pass,'yblcatx') AS passdecode FROM contacts WHERE contact_id = $contact_id";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php include("include_header.html"); ?>
<table>
<tr valign="top">
<td align="left"><span class="yb_heading3red"><?php echo $error_message; ?></span></td>
</tr>
<tr>
<td align="center">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="500" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
<tr valign="baseline">
<td width="200" align="right" nowrap>Contact_id:</td>
<td><?php echo $row_Recordset1['contact_id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">First_name:</td>
<td><input type="text" name="first_name" value="<?php echo $row_Recordset1['first_name']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Middle_initial:</td>
<td><input name="middle_initial" type="text" value="<?php echo $row_Recordset1['middle_initial']; ?>" size="1" maxlength="1"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Last_name:</td>
<td><input type="text" name="last_name" value="<?php echo $row_Recordset1['last_name']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td><input type="text" name="email" value="<?php echo $row_Recordset1['email']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Date of Birth: </td>
<td><input type="text" name="DOB" value="<?php echo $row_Recordset1['DOB']; ?>" size="10" />
(YYYY-MM-DD) </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Receive YBP Newsletter?:</td>
<td><?php list_yes_no(list_yes_no,$row_Recordset1['receive_newsletter']); ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Phone:</td>
<td><input type="text" name="phone" value="<?php echo $row_Recordset1['phone']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Address1:</td>
<td><input type="text" name="address1" value="<?php echo $row_Recordset1['address1']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Address2:</td>
<td><input type="text" name="address2" value="<?php echo $row_Recordset1['address2']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">City:</td>
<td><input type="text" name="city" value="<?php echo $row_Recordset1['city']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">State:</td>
<td><input name="state" type="text" value="<?php echo $row_Recordset1['state']; ?>" size="2" maxlength="2"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">ZIP:</td>
<td><input type="text" name="zip" value="<?php echo $row_Recordset1['zip']; ?>" size="5"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">New Password:</td>
<td><input name="password" type="password" id="password" value="<?php echo $row_Recordset1['passdecode']; ?>" size="32">
<br />
Your password keeps others from viewing your personal information. </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Update Contact Info"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
<input type="hidden" name="contact_id" value="<?php echo $row_Recordset1['contact_id']; ?>">
<input type="hidden" name="contact_id_entry" value="<?php echo $contact_id_entry; ?>">
</form> </td>
</tr>
</table>
<p>&nbsp;</p>
<?php include("include_footer.html"); ?>
<?php
mysql_free_result($Recordset1);
?>