// Generic dynamic template for OBCI Web Site // Designed by Katherine Koch // July 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['Event'])) { $EventName = $_POST['event_name']; $EventAddress = $_POST['event_address']; $EventCity = $_POST['event_city']; $EventState = $_POST['event_state']; $EventZip = $_POST['event_zip']; $EventHost = $_POST['event_host']; $EventPhone = $_POST['event_phone']; $EventWeb = $_POST['event_web']; $EventEmail = $_POST['event_email']; $EventMonth = $_POST['event_month']; $EventYear = $_POST['event_year']; $EventDate = $_POST['event_dates']; $EventDescription = $_POST['event_description']; $ContactName = $_POST['contact_name']; $ContactEmail = $_POST['contact_email']; $ContactOrganization = $_POST['contact_org']; // 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($EventWeb) && preg_match("/^www/i", "$EventWeb")) { $EventWeb = "http://" . $EventWeb; } // Keep track of the number of errors (missing info, etc.) $error = 0; ////////$OBCIEMAIL = "guardian2075@yahoo.com"; $OBCIEMAIL = "events@obcinet.org"; if (is_blank($EventName) || isSpam($EventName)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventName)) { spamWarning("this is not a valid event name"); } else { error("your information for the event name field"); } } else if (is_blank($EventAddress) || isSpam($EventAddress)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventAddress)) { spamWarning("this is not a valid address"); } else { error("your information for the address field"); } } else if (is_blank($EventCity) || isSpam($EventCity)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventCity)) { spamWarning("this is not a valid city name"); } else { error("your information for the city field"); } } else if (is_blank($EventState) || isSpam($EventState)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventState)) { spamWarning("this is not a valid state name"); } else { error("your information for the state field"); } } else if (is_blank($EventZip) || isSpam($EventZip)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventZip)) { spamWarning("this is not a valid event name"); } else { error("your information for the event name field"); } } else if (is_blank($EventHost) || isSpam($EventHost)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventHost)) { spamWarning("this is not a valid host name"); } else { error("your information for the event host field"); } } else if (is_blank($EventPhone) || isSpam($EventPhone)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventPhone)) { spamWarning("this is not a valid phone number"); } else { error("your information for the phone number field"); } } else if (isSpam($EventWeb)) { // Note that an error occurred, and this will prevent emails from going out. $error++; spamWarning("this is not valid web address"); } 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 event contact 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 (is_blank($EventMonth) || isSpam($EventMonth)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventMonth)) { spamWarning("this is not a valid month name"); } else { error("your information for the event month field"); } } else if (is_blank($EventYear) || isSpam($EventYear)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventYear)) { spamWarning("this is not a valid year"); } else { error("your information for the event year field"); } } else if (is_blank($EventDate) || isSpam($EventDate)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventDate)) { spamWarning("this is not a valid event date"); } else { error("your information for the event date field"); } } else if (is_blank($EventDescription) || isSpam($EventDescription)) { // Note that an error occurred, and this will prevent emails from going out. $error++; if (isSpam($EventDescription)) { spamWarning("this is not a valid event description"); } else { error("your information for the event description 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 (! eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $ContactEmail) || is_blank($ContactEmail)) { $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($ContactOrganization)) { // Note that an error occurred, and this will prevent emails from going out. $error++; spamWarning("this is not a valid organization name"); } if (! $error) { // send emails $date = date("Y-m-d"); $query = "SELECT COUNT(ID) As count FROM " . $_SESSION['db_name'] . ".OBCI_EVENTS WHERE EventName LIKE '$EventName' AND Date LIKE '$date' AND ContactName LIKE '$ContactName';"; $res = mysql_fetch_array(mysql_query($query)); $count = $res['count']; if ($count == "0") { $query = "INSERT INTO " . $_SESSION['db_name'] . ".OBCI_EVENTS VALUES('', '$date', '0', '$EventName', '$EventAddress', '$EventCity', '$EventState', '$EventZip', '$EventHost', '$EventPhone', '$EventWeb', '$EventEmail', '$EventMonth', '$EventYear', '$EventDate', '$EventDescription', '$ContactName', '$ContactEmail', '$ContactOrganization');"; $res = mysql_query($query); } else { ?>According to our records, you have already submitted a notification for this event. 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($ContactEmail)) { $message2 .= "Dear $ContactName,\n\n"; $message2 .= "Thank you for informing the OBCI community about your event! After a short review process, we will post this on our web site under the month and year that you have specified.\n\n"; $message2 .= "Sincerely,\n"; $message2 .= "\n"; $message2 .= "Suzanne Cardinal\n"; $message2 .= "Coordinator\n"; $message2 .= "Ohio Bird Conservation Initiative\n"; // Send the email sendEmail($ContactEmail, $OBCIEMAIL, "OBCI - Event Notification Received", $message2); } $From = $ContactEmail; sendEmailQuiet($OBCIEMAIL, $From, "OBCI EVENT NOTIFICATION", $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 event notification has been sent to the OBCI Coordinator. Thank you for your interest!
Unfortunately, your event 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!