\n"); fputs($fp, "To: <${emailAddress}>\n"); fputs($fp, "Subject: FamilyResource.com Email Confirmation\n"); fputs($fp, "\n". ($emailTime < 0 ? $newsletterUnsub : $newsletterSub)); fputs($fp, "http://www.familyresource.com/newsletter/?ge=${emailID}:${validationHash}\n\n"); fputs($fp, wordwrap("If you have any problems, please feel free to contact our support team at .\n", 75)); fputs($fp, "\n"); pclose($fp); } $currentTime = time(); $formKey = "fr!form:key"; $pageTitle = "Newsletter"; require("phpinc/page_header.php"); ?>
Form entry timed out, please try again.
"; elseif (!validEmail($formIn['Email'])) $formError = "
Please verify the email address you provided, and try again.
"; elseif (isset($formIn['butSub']) || isset($formIn['butUnsub'])) { require("phpinc/mysql.inc"); $sqlConn = new SQLConnection(); $tmpData = $sqlConn->QueryFetchArray("SELECT ID,Verification FROM Newsletter WHERE Email='${formIn['Email']}'"); if (is_array($tmpData) && $tmpData['Verification'] == 0 && isset($formIn['butSub'])) $formError = "
That email is already subscribed to the mailing list.
"; elseif ((!is_array($tmpData) || $tmpData['Verification'] > 0) && isset($formIn['butUnsub'])) $formError = "
That email is not subscribed to the mailing list.
"; } } if (!empty($_GET['ge'])) { list($verifyID, $verifyData) = explode(":", trim($_GET['ge'])); if (strlen($verifyData) != 32 || empty($verifyID)) $verifyMessage = "
The verification data you provided is not in the correct format. Please check the address in your email and try again.
"; else { require("phpinc/mysql.inc"); $sqlConn = new SQLConnection(); $tmpData = $sqlConn->QueryFetchArray("SELECT * FROM Newsletter WHERE ID='${verifyID}'"); if (!is_array($tmpData)) $verifyMessage = "
Could not locate your account in the database. Please check the address in your email and try again. If you continue to experience problems, please try starting the newsletter signup process over.
"; else { $verifyHash = md5("${tmpData['Email']}${tmpData['ID']}${tmpData['Verification']}"); if ($verifyData != $verifyHash) $verifyMessage = "
The verification data you provided does not match our database. Please check the address in your email and try again. If you continue to experience problems, please try starting the newsletter signup process over.
"; elseif ($tmpData['Verification'] < 0) { $sqlConn->RunQuery("DELETE FROM Newsletter WHERE ID='${verifyID}'"); $verifyMessage = "
Your request has been confirmed and you have been unsubscribed from the FamilyResource.com Newsletter.
"; } else { $sqlConn->RunQuery("UPDATE Newsletter SET Verification=NULL WHERE ID='${verifyID}'"); $verifyMessage = "
Your email address has been verified and your signup to the FamilyResource.com Newsletter has been completed.
"; } } } ?>

Newsletter (Mailing List)

Newsletter (Mailing List)

To subscribe, or unsubscribe from the newsletter, please enter your email address in the box provided.

Email Address

RunQuery("REPLACE INTO Newsletter (ID, Email, Verification) VALUES ". "(${currentID}, '${formIn['Email']}', ${dbCurrentTime})"); list($currentID) = $sqlConn->QueryFetchArray("SELECT ID FROM Newsletter WHERE Email='${formIn['Email']}'"); if (!empty($currentID)) { sendVerificationEmail($formIn['Email'], $currentID, $dbCurrentTime); ?>

Newsletter (Mailing List)

An email has been sent to the address you provided to confirm your request. After you've visited the web address provided in that email, you will be subscribed to the FamilyResource.com Newsletter.