// Generic dynamic template for OBCI Web Site // This generic template is specifically coded for the newsletter/mailing list signup form. // Designed by Katherine Koch // August 2006 ?> include("/home/obcinet2/public_html/includes/config.php.inc"); ?> includes("sign_in"); ?> // First find out the name of this page $Filename = $_SERVER['PHP_SELF']; $query = "SELECT * FROM " . $_SESSION['db_name'] . ".CONTENT LEFT JOIN " . $_SESSION['db_name'] . ".FRAME ON " . $_SESSION['db_name'] . ".CONTENT.Frame = " . $_SESSION['db_name'] . ".FRAME.Frame_ID WHERE Filename = '$Filename';"; $res = mysql_query($query); // Gather data $data = mysql_fetch_array($res); $Title = $data['Title']; $Section_ID = $data['Section_ID']; $Content = $data['Content']; $Frame = $data['Frame_URI']; ?> function content($Content) { if (isset($_POST['Subscribe'])) { $Name = $_POST['name']; $Email = $_POST['email']; $Affiliation = $_POST['affiliation']; $HowHear = $_POST['howhear']; $Volunteer = $_POST['volunteer']; if ($Volunteer == "Yes") { $Volunteer = 1; } // Keep track of the number of errors (missing info, etc.) $error = 0; ////////$OBCIEMAIL = "guardian2075@yahoo.com"; $OBCIEMAIL = "newsletter@obcinet.org"; if (is_blank($Name) || isSpam($Name)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($Name)) { spamWarning("this is not a valid name"); } else { error("your information for the name field"); } } else if (! eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $Email) || is_blank($Email)) { $error++; print "
Please double-check the email address that you provided. Are you sure it's correct? Return to the form and give it another try. Thank you.
\n"; } else if (isSpam($Affiliation)) { // Note that an error occurred, and this will prevent emails from going out. $error++; spamWarning("this is not valid information for your affiliation"); } else if (isSpam($HowHear)) { // Note that an error occurred, and this will prevent emails from going out. $error++; spamWarning("this is not valid information for the question, 'How did you hear about OBCI?'"); } if (! $error) { // send emails $query = "SELECT COUNT(ID) As count FROM " . $_SESSION['db_name'] . ".MAILING_LIST WHERE Name LIKE '$Name' AND Email LIKE '$Email';"; $res = mysql_fetch_array(mysql_query($query)); $count = $res['count']; $date = date("Y-m-d"); if ($count == "0") { $query = "INSERT INTO " . $_SESSION['db_name'] . ".MAILING_LIST VALUES('', '$date', '$Name', '$Email', '$Affiliation', '$HowHear', '$Volunteer');"; $res = mysql_query($query); } else { ?>According to our records, you have already signed up for our newsletter. If you attempted to revisit or refresh this page after filling out the form, then you may disregard this message and rest assured that we received your information. If you have any questions, feel free to contact us.
return; } // First compose email to OBCI: $message1 = "-- END OF MESSAGE --
"; if (! is_blank($Email)) { $message2 .= "Dear $Name,\n\n"; $message2 .= "Welcome! Thank you for subscribing to our mailing list and newsletter! We publish a newsletter every couple of months and we send out informative emails about OBCI and the progress we are making. (Don't worry we will not bombard your inbox with emails!) Our newsletter should keep you up to date on our committees, projects, and information related to bird conservation in the state. You are welcome to submit an idea for an article at anytime! Please email us at coordinator@obcinet.org. \n\n"; $message2 .= "If for any reason you would like to stop receiving our newsletter or emails just let us know! \n\n"; $message2 .= "\n\n"; $message2 .= "Sincerely,\n\n"; $message2 .= "Coordinator\n"; $message2 .= "Ohio Bird Conservation Initiative\n"; // Send the email sendEmail($Email, $OBCIEMAIL, "OBCI - Newsletter Registration Received", $message2); } $From = $Email; sendEmailQuiet($OBCIEMAIL, $From, "OBCI NEWSLETTER REGISTRATION", $message1); } // end if for error checking } else { print "$Content"; } } ?> include($Frame); ?> print "\n"; ?> function is_blank($string){ $len = strlen($string); return (strlen($string) == 0); } ?> function error($string) { ?>We're sorry, we did not receive print "$string"; ?>. Please return to the form and provide this missing information. Thank you!
If you are having difficulties with our online form, you are welcome to contact us directly webmaster@obcinet.org.
We're sorry, print "$string"; ?>. Our online form does not permit the inclusion of strange characters or hyperlinks in a response. Please return to the form. Try removing any links you may have included and use only plain alphanumeric characters for your answers. Thank you!
If you are having difficulties with our online form, you are welcome to contact us directly webmaster@obcinet.org.
Your newsletter registration has been sent to the OBCI Coordinator. Thank you for your interest!
Unfortunately, your registration notification was not successfully sent. We apologize for the inconvenience, and encourage you to contact us directly by email. Thank you for your interest in OBCI!