// Generic dynamic template for OBCI Web Site // This template designed specifically for the OBCI Join Us 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['Join'])) { $Organization = $_POST['organization']; $ContactName = $_POST['name']; $Address = $_POST['address']; $City = $_POST['city']; $State = $_POST['state']; $Zip = $_POST['zip']; $Phone = $_POST['phone']; $Email = $_POST['email']; $Web = $_POST['web']; $Newsletter = $_POST['newsletter']; // Convert checkbox 'on' to binary if ($Newsletter == "on") { $Newsletter = 1; } else { $Newsletter = 0; } // Check for 'http://' prefix // Note: if the web addresses for these members are shown on the web site and they lack the 'http://' prefix, // due to the base href, the browser will interpret the address as 'http://www.obcinet.org/www.someaddress.com'. // In order to avoid this, if a web address is given and its prefix begins with 'www', fix it here. if (! is_blank($Web) && preg_match("/^www/i", "$Web")) { $Web = "http://" . $Web; } // Keep track of the number of errors (missing info, etc.) $error = 0; ////////$OBCIEMAIL = "guardian2075@yahoo.com"; $OBCIEMAIL = "joinobci@obcinet.org"; if (is_blank($Organization) || isSpam($Organization)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($Organization)) { spamWarning("this is not a valid organization name"); } else { error("your information for the organization field"); } } else if (is_blank($ContactName) || isSpam($ContactName)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($ContactName)) { spamWarning("this is not a valid contact name"); } else { error("your information for the contact name field"); } } else if (is_blank($Address) || isSpam($Address)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($Address)) { spamWarning("this is not a valid mailing address"); } else { error("your information for the mailing address field"); } } else if (is_blank($City) || isSpam($City)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($City)) { spamWarning("this is not a valid city"); } else { error("your information for the city field"); } } else if (is_blank($State) || isSpam($State)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($State)) { spamWarning("this is not a valid state"); } else { error("your information for the state field"); } } else if (is_blank($Zip) || isSpam($Zip)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($Zip)) { spamWarning("this is not a valid zip code"); } else { error("your information for the zip code field"); } } else if (is_blank($Phone) || isSpam($Phone)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($Phone)) { spamWarning("this is not a valid name"); } else { error("your information for the phone 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($Web)) { // Note that an error occurred, and this will prevent emails from going out. $error++; spamWarning("this is not valid web address"); } if (! $error) { // send emails $query = "SELECT COUNT(ID) As count FROM " . $_SESSION['db_name'] . ".JOIN_OBCI WHERE Organization LIKE '$Organization' AND ContactName LIKE '$ContactName';"; $res = mysql_fetch_array(mysql_query($query)); $count = $res['count']; $date = date("Y-m-d"); if ($count == "0") { $query = "INSERT INTO " . $_SESSION['db_name'] . ".JOIN_OBCI VALUES('', '$date', '$Organization', '$ContactName', '$Address', '$City', '$State', '$Zip', '$Phone', '$Email', '$Web', '$Newsletter');"; $res = mysql_query($query); if ($Newsletter) { // First check to see if the email addresss is already in the db. If not, then insert it. $query = "SELECT COUNT(ID) As count FROM " . $_SESSION['db_name'] . ".MAILING_LIST WHERE Email LIKE '$Email';"; $res = mysql_fetch_array(mysql_query($query)); $count = $res['count']; if (! $count) { $query = "INSERT INTO " . $_SESSION['db_name'] . ".MAILING_LIST VALUES('', '$date', '$ContactName', '$Email', 'NOTE: This subscriber opted in via the \"Join OBCI\" online form. The organization opting in for membership is $Organization.', 'NOTE: This subscriber opted in via the \"Join OBCI\" online form.', '0');"; $res = mysql_query($query); } } } else { ?>According to our records, you have already applied for membership in OBCI. 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 $ContactName,\n\n"; $message2 .= "Thank you for applying for membership to OBCI! We will contact you and your organization shortly about the status of your membership.\n\n"; $message2 .= "Endorsing OBCI requires no financial or other commitment to any specific actions. It does require, however, a desire to deliver the full spectrum of bird conservation in Ohio through landscape-scale assessment and management, guided by sound science and using voluntary stewardship. You will be encouraged (but not required) to attend an annual meeting at which your organization and the full OBCI membership would have an opportunity to provide input and learn about progress towards OBCI activities, objectives, and future plans. \n\n"; $message2 .= "We look forward to working with you and your organization! Thanks again for your interest.\n"; $message2 .= "\n\n"; $message2 .= "Sincerely,\n"; $message2 .= "\n"; $message2 .= "Coordinator\n"; $message2 .= "Ohio Bird Conservation Initiative\n"; // Send the email sendEmail($Email, $OBCIEMAIL, "OBCI - Membership Application Received", $message2); } $From = $Email; sendEmailQuiet($OBCIEMAIL, $From, "OBCI MEMBERSHIP APPLICATION", $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 request for membership 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!