"Sun", "1" => "Mon", "2" => "Tue", "3" => "Wed", "4" => "Thu", "5" => "Fri", "6" => "Sat"); //set the LocationID if it's not defined if (!$LocationID) { $LocationID = "0"; } // We've got some data processing to do! // first check all of the common elements // check for mising title if ($Returned == 1 AND !$Title) { commonHeader($glbl_SiteTitle); echo "
You did not specify an EVENT NAME OR TITLE. Please complete the form below.

\n\n"; // the common data checks out, lets check our other data } elseif ($Returned == 1) { // set the Active state based on the config option if ($glbl_ApprovePublicSubmission != 1) { $Active = 1; } else { $Active = 0; } // START CHECKS FOR DAILY EVENTS if ($EventType == "Daily") { // check the start date if (!checkdate($DailyStartMonth, $DailyStartDay, $DailyStartYear)) { commonHeader("Add an item"); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($DailyStopMonth AND (!checkdate($DailyStopMonth, $DailyStopDay, $DailyStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $StartDate = $DailyStartYear."-".$DailyStartMonth."-".$DailyStartDay; $StopDate = $DailyStopYear."-".$DailyStopMonth."-".$DailyStopDay; // make sure the start comes before the stop if ($DailyStopYear) { $result = $db_secondary->query ("SELECT (TO_DAYS('$StopDate') - TO_DAYS('$StartDate'))"); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'"); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO phpCalendar_EventLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')"); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations"); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')"); $result = $db_secondary->query ("SELECT LAST_INSERT_ID() FROM phpCalendar_Details"); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_Daily VALUES( '$StartDate','$StopDate','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminUsers WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR DAILY EVENTS // START CHECKS FOR WEEKLY EVENTS } elseif ($EventType == "Weekly") { // check for missing days for ($i = 0; $WeekDays[$i]; $i++) { if ($WeeklyDays[$i] == 1) { $GotDays = 1; } } if ($GotDays != 1) { commonHeader($glbl_SiteTitle); echo "

You DID NOT SELECT ANY DAYS. Please complete the form below.

\n\n"; $Stop = 1; // check the start date } elseif (!checkdate($WeeklyStartMonth, $WeeklyStartDay, $WeeklyStartYear)) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($WeeklyStopMonth AND (!checkdate($WeeklyStopMonth, $WeeklyStopDay, $WeeklyStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $DisplayStart = $WeeklyStartYear."-".$WeeklyStartMonth."-".$WeeklyStartDay; $DisplayStop = $WeeklyStopYear."-".$WeeklyStopMonth."-".$WeeklyStopDay; // make sure the start comes before the stop if ($WeeklyStopYear) { $result = $db_secondary->query("SELECT (TO_DAYS('$DisplayStop') - TO_DAYS('$DisplayStart'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'") or die(mysql_error()); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO phpCalendar_EventLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // make a string with the days of the week for ($i = 0; $WeekDays[$i]; $i++) { if ($WeeklyDays[$i] == 1) { $DaysOfWeek .= "|$i"; } } $DaysOfWeek = ereg_replace("^\|","",$DaysOfWeek); // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_Weekly VALUES( '$DaysOfWeek','$DisplayStart','$DisplayStop','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminEmail WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; if ($glbl_ApprovePublicSubmission == 1) { mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); } Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR WEEKLY EVENTS // START CHECKS FOR MONTHLY EVENTS } elseif ($EventType == "Monthly") { // check for valid DayOfMonth if (!$MonthlyDayOfMonth OR $MonthlyDayOfMonth > 31 OR $MonthlyDayOfMonth < 1) { commonHeader($glbl_SiteTitle); echo "

That DAY OF MONTH IS INVALID. Please complete the form below.

\n\n"; $Stop = 1; // check the start date } elseif (!checkdate($MonthlyStartMonth, $MonthlyStartDay, $MonthlyStartYear)) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($MonthlyStopMonth AND (!checkdate($MonthlyStopMonth, $MonthlyStopDay, $MonthlyStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $DisplayStart = $MonthlyStartYear."-".$MonthlyStartMonth."-".$MonthlyStartDay; $DisplayStop = $MonthlyStopYear."-".$MonthlyStopMonth."-".$MonthlyStopDay; // make sure the start comes before the stop if ($MonthlyStopYear) { $result = $db_secondary->query("SELECT (TO_DAYS('$DisplayStop') - TO_DAYS('$DisplayStart'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'") or die(mysql_error()); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO phpCalendar_EventLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_Monthly VALUES( '$MonthlyDayOfMonth','$DisplayStart','$DisplayStop','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminEmail WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; if ($glbl_ApprovePublicSubmission == 1) { mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); } Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR MONTHLY EVENTS // START CHECKS FOR YEARLY EVENTS } elseif ($EventType == "Yearly") { // check for valid Day if (!$YearlyDayOfMonth OR $YearlyDayOfMonth > 31 OR $YearlyDayOfMonth < 1) { commonHeader($glbl_SiteTitle); echo "

That DAY OF MONTH MONTH IS INVALID. Please complete the form below.

\n\n"; $Stop = 1; // check the start date } elseif (!checkdate($YearlyStartMonth, $YearlyStartDay, $YearlyStartYear)) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($YearlyStopMonth AND (!checkdate($YearlyStopMonth, $YearlyStopDay, $YearlyStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $DisplayStart = $YearlyStartYear."-".$YearlyStartMonth."-".$YearlyStartDay; $DisplayStop = $YearlyStopYear."-".$YearlyStopMonth."-".$YearlyStopDay; // make sure the start comes before the stop if ($YearlyStopYear) { $result = $db_secondary->query("SELECT (TO_DAYS('$DisplayStop') - TO_DAYS('$DisplayStart'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'") or die(mysql_error()); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO EVENTLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_Yearly VALUES( '$YearlyMonth','$YearlyDayOfMonth','$DisplayStart','$DisplayStop','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminEmail WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; if ($glbl_ApprovePublicSubmission == 1) { mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); } Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR YEARLY EVENTS // START CHECKS FOR MONTHLY PERIODICAL EVENTS } elseif ($EventType == "MonthlyP") { // check for missing days for ($i = 0; $WeekDays[$i]; $i++) { if ($MonthlyPWeekDays[$i] == 1) { $GotDays = 1; } } if ($GotDays != 1) { commonHeader($glbl_SiteTitle); echo "

You DID NOT SELECT ANY DAYS. Please complete the form below.

\n\n"; $Stop = 1; // check the start date } elseif (!checkdate($MonthlyPStartMonth, $MonthlyPStartDay, $MonthlyPStartYear)) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($MonthlyPStopMonth AND (!checkdate($MonthlyPStopMonth, $MonthlyPStopDay, $MonthlyPStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $DisplayStart = $MonthlyPStartYear."-".$MonthlyPStartMonth."-".$MonthlyPStartDay; $DisplayStop = $MonthlyPStopYear."-".$MonthlyPStopMonth."-".$MonthlyPStopDay; // make sure the start comes before the stop if ($MonthlyPStopYear) { $result = $db_secondary->query("SELECT (TO_DAYS('$DisplayStop') - TO_DAYS('$DisplayStart'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'") or die(mysql_error()); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO phpCalendar_EventLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // make a string with the days of the week for ($i = 0; $WeekDays[$i]; $i++) { if ($MonthlyPWeekDays[$i] == 1) { $ShowWeekDays .= "|$i"; } } $ShowWeekDays = ereg_replace("^\|","",$ShowWeekDays); // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_PeriodicalMonthly VALUES( '$MonthlyPWeekNumber','$ShowWeekDays','$DisplayStart','$DisplayStop','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminEmail WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; if ($glbl_ApprovePublicSubmission == 1) { mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); } Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR MONTHLY PERIODICAL EVENTS // START CHECKS FOR YEARLY PERIODICAL EVENTS } elseif ($EventType == "YearlyP") { // check for missing days for ($i = 0; $WeekDays[$i]; $i++) { if ($YearlyPWeekDays[$i] == 1) { $GotDays = 1; } } if ($GotDays != 1) { commonHeader($glbl_SiteTitle); echo "

You DID NOT SELECT ANY DAYS. Please complete the form below.

\n\n"; $Stop = 1; // check the start date } elseif (!checkdate($YearlyPStartMonth, $YearlyPStartDay, $YearlyPStartYear)) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID START DATE. Please complete the form below.

\n\n"; $Stop = 1; // check the end date } elseif ($YearlyPStopMonth AND (!checkdate($YearlyPStopMonth, $YearlyPStopDay, $YearlyPStopYear))) { commonHeader($glbl_SiteTitle); echo "

You specified an INVALID END DATE. Please complete the form below.

\n\n"; $Stop = 1; } // Compile the dates $DisplayStart = $YearlyPStartYear."-".$YearlyPStartMonth."-".$YearlyPStartDay; $DisplayStop = $YearlyPStopYear."-".$YearlyPStopMonth."-".$YearlyPStopDay; // make sure the start comes before the stop if ($YearlyPStopYear) { $result = $db_secondary->query("SELECT (TO_DAYS('$DisplayStop') - TO_DAYS('$DisplayStart'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } // somebody was trying to trick by making a stop date // before it was started if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "

Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.

\n\n"; // all of our checks on the surface data was good } elseif ($Stop != 1) { // check to see if the CalendarLocation already exists if (!$EventLocationID) { $result = $db_secondary->query("SELECT EventLocationID FROM phpCalendar_EventLocations WHERE LocationID = '$LocationID' AND Title = '$CLTitle' AND Address1 = '$Address1' AND Address2 = '$Address2' AND City = '$City' AND State = '$State'") or die(mysql_error()); $CountLocations = mysql_num_rows($result); } else { $CountLocations = 99; } if ($CountLocations > 0 AND $CountLocations < 99) { while($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } elseif ($CountLocations != 99 AND $CLTitle) { $db_secondary->query("INSERT INTO EventLocations VALUES ( '$CLTitle','$Address1','$Address2','$City','$State','$Zip','$LocationID','')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_EventLocations") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $EventLocationID = $row[0]; } } // if the web address doesn't begin with http:// if ($ContactWeb AND !eregi("http://",$ContactWeb)) { $ContactWeb = "http://".$ContactWeb; } // make a string with the days of the week for ($i = 0; $WeekDays[$i]; $i++) { if ($YearlyPWeekDays[$i] == 1) { $ShowWeekDays .= "|$i"; } } $ShowWeekDays = ereg_replace("^\|","",$ShowWeekDays); // format the times if ($StartPeriod == PM AND $StartHour != 12) { $StartHour += 12; } elseif ($StartPeriod == AM AND $StartHour == 12) { $StartHour = 0; } if ($EndPeriod == PM AND $EndHour != 12) { $EndHour += 12; } elseif ($EndPeriod == AM AND $EndHour == 12) { $EndHour = 0; } $StartTime = $StartHour.":".$StartMinute; $EndTime = $EndHour.":".$EndMinute; // we can insert now $db_secondary->query("INSERT INTO phpCalendar_Details VALUES ( '$Title','$Details','$ContactName','$ContactPhone','$ContactEmail','$ContactWeb', '$EventLocationID','$StartTime','$EndTime','$ShowStart','$ShowEnd', '$LocationID','$CalendarDetailsID')") or die(mysql_error()); $result = $db_secondary->query("SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } $db_secondary->query("INSERT INTO phpCalendar_PeriodicalYearly VALUES( '$YearlyPMonth','$ShowWeekDays','$YearlyPWeekNumber','$DisplayStart','$DisplayStop','$Active','$LocationID','$CalendarDetailsID')") or die(mysql_error()); // do we send a notification and to whom? if ($glbl_ApprovePublicSubmission == 1 AND ($glbl_ApprovalBySiteAdmin == 1 OR !$LocationID)) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } elseif ($glbl_ApprovePublicSubmission == 1) { $result = $db_secondary->query("SELECT Email FROM phpCalendar_AdminEmail WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $MailTo = $row[0]; } $AddrVar = $glbl_WebAdminRoot; } // what if we still don't have an address? if (!$MailTo) { $MailTo = $glbl_AdminEmail; $AddrVar = $glbl_AdminRoot; } $Message = " A request has been generated from your web site for a calendar submission to be approved. Visit the address: ".$glbl_WebAddress.$AddrVar." Once logged in, select the \"Pending event administration\" link. Thank you. "; if ($glbl_ApprovePublicSubmission == 1) { mail($MailTo, $glbl_EmailSubject, $Message, "From: $glbl_MailFrom", "-f$MailTo"); } Header("Location: ./thankyou.php?LocationID=$LocationID"); exit; } // END CHECKS FOR YEARLY PERIODICAL EVENTS } // we haven't returned, so do everything else } else { commonHeader($glbl_SiteTitle); } if (!$EventType) { $EventType = "Daily"; } popUp(300,200); ?> Adding a calendar item...

Select the appropriate items from ONE of the colored boxes and complete the information at the bottom.

One-Time Events
 "; } else { echo " "; } ?> Check here if this is a one-time event or multiple day event that will only happen once.   What's This?
Start date:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($DailyStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
End date:
\n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($DailyStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
"; ?>
Weekly Recurring Events
 "; } else { echo " "; } ?> Check here if this event recurs weekly.   What's This?
Select the days of the week to display this event:
 $WeekDays[$i] \n"; } else { echo " $WeekDays[$i] \n"; } } ?>
Display this event between:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($WeeklyStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  AND  \n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($WeeklyStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
"; ?>
Monthly Recurring Events
(Events that occur on the same day every month)
 "; } else { echo " "; } ?> Check here if this event recurs monthly.   What's This?
Specify the day of the month to display this event: 
Display this event between:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($MonthlyStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  AND  \n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($MonthlyStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
\n"; ?> "; ?>
Annually Recurring Events
(Events that occur on the same day every year - i.e. Christmas)
 "; } else { echo " "; } ?> Check here if this event recurs annually.   What's This?
Specify the month that this event occurs:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "
Specify the day of the month that this event occurs:
Display this event between:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  AND  \n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
\n"; ?> "; ?>
Monthly Periodical Events
(Events that occur on a day of a given week - i.e. "The third Thursday of every month")
 "; } else { echo " "; } ?> Check here if this is a monthly periodical event.   What's This?
Specify the week number:
\n"; for ($i = 1; $i <= 5; $i++) { $showWeekNum = date("jS",mktime(0,0,0,date("m"),$i,date("Y"))); if ($MonthlyPWeekNumber == $i) { echo "\n"; } else { echo "\n"; } } echo "
Specify the days of the week:
 $WeekDays[$i] \n"; } else { echo " $WeekDays[$i] \n"; } } ?>
Display this event between:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($MonthlyPStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  AND  \n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($MonthlyPStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
\n"; ?> \n"; ?> "; ?>
Annual Periodical Events
(Events that occur on a day of a given week of a particular month - i.e. "The third Thursday of November")
 "; } else { echo " "; } ?> Check here if this is an annual periodical event.   What's This?
Specify the month that this event occurs:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyPMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "
Specify the week number:
\n"; for ($i = 1; $i <= 5; $i++) { $showWeekNum = date("jS",mktime(0,0,0,date("m"),$i,date("Y"))); if ($YearlyPWeekNumber == $i) { echo "\n"; } else { echo "\n"; } } echo "
Specify the days of the week:
 $WeekDays[$i] \n"; } else { echo " $WeekDays[$i] \n"; } } ?>
Display this event between:
\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyPStartMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  AND  \n"; echo "\n"; for ($i = 1; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } $showMonth = date("F",mktime(0,0,0,$i,1,date("Y"))); if ($YearlyPStopMonth == $i) { echo "\n"; } else { echo "\n"; } } echo "  \n\n"; // get the day echo "  \n\n"; // get the year echo "  \n\n"; ?>
Common Event Information
Event name or title:
Event details:
Contact name:
Contact phone:
Contact email:
Contact web site:
Event location:
OR Specify the location information below.
Location title:

Location address 1:
Location address 2:
Location city:
Location state and zip code:
  
Start time:
 : 
 AM
\n"; echo " PM\n"; } else { echo " AM
\n"; echo " PM\n"; } ?>
End time:
 : 
 AM
\n"; echo " PM\n"; } else { echo " AM
\n"; echo " PM\n"; } ?>
 \n"; } else { echo " \n"; } ?> Check to display start time  \n"; } else { echo " \n"; } ?> Check to display end time