purchase more basic seminar listings
in order to post any more seminars."; } else { $sql = "select * from Seminar where seminarID=$seminarID and companyID=$companyID"; $result = mysql($database, $sql); $num = mysql_numrows($result); if ($num == 0) { $errors = "Sorry - seminar and company do not match."; } } } } } if (($edit || $add) && !$errors) { if ($edit) { $e=0; while ($e<$how_many_edits) { $sql=""; $seminarDatesIDname = "id$e"; $delete_name = "delete_edit$e"; if ($$delete_name) { $sql = "delete from SeminarDates where seminarDatesID=${$seminarDatesIDname}"; } /* if */ else { $cityname = "otherCity_edit$e"; $stateIDname = "otherStateID_edit$e"; $countryIDname = "otherCountryID_edit$e"; $leadername = "leader_edit$e"; $metroIDname = "metroID_edit$e"; if (!$$metroIDname) { $$metroIDname = 0; } $fyname = "fromYear_edit$e"; $fmname = "fromMonth_edit$e"; $fdname = "fromDay_edit$e"; $tyname = "toYear_edit$e"; $tmname = "toMonth_edit$e"; $tdname = "toDay_edit$e"; $exactLocation = "exactLocation_edit$e"; $regCode = "regCode_edit$e"; $listingType = "listingType_edit$e"; if (!$$cityname) { $errors = "Some dates not updated! (missing city)"; } /* if */ elseif ((!$$stateIDname && !$$countryIDname) || ($$stateIDname && $$countryIDname)) { $errors = "Some dates not updated! (missing state or country, or both selected)"; } /* elseif */ else { /* if country code chosen, we know it's not USA or Canada, otherwise they would've chosen a state/province-country. */ /* so, we'll need to create a State record with a blank description and this country code (unless it already exists) */ if ($$countryIDname) { $sql = "select stateID from State where state='' and countryID=${$countryIDname}"; $result = mysql($database, $sql); $num = mysql_numrows($result); if ($num) { $$stateIDname = mysql_result($result,$i,"stateID"); } /* if */ else { $sql = "insert into State values ('', '', '', ${$countryIDname}, '$now', '')"; $result = mysql($database, $sql); $$stateIDname = mysql_insert_id(); } /* else */ } /* if */ /* here we check to see if the record was actually changed. if not, don't do the update */ $old_cityname = "old_$cityname"; $old_stateIDname = "old_$stateIDname"; $old_countryIDname = "old_$countryIDname"; $old_leadername = "old_$leadername"; $old_metroIDname = "old_$metroIDname"; $old_fyname = "old_$fyname"; $old_fmname = "old_$fmname"; $old_fdname = "old_$fdname"; $old_tyname = "old_$tyname"; $old_tmname = "old_$tmname"; $old_tdname = "old_$tdname"; $old_exactLocation = "old_$exactLocation"; $old_regCode = "old_$regCode"; $old_listingType = "old_$listingType"; if ($$cityname != $$old_cityname || $$stateIDname != $$old_stateIDname || $$countryIDname != $$old_countryIDname || $$leadername != $$old_leadername || $$metroIDname != $$old_metroIDname || $$fyname != $$old_fyname || $$fmname != $$old_fmname || $$fdname != $$old_fdname || $$tyname != $$old_tyname || $$tmname != $$old_tmname || $$tdname != $$old_tdname || $$exactLocation != $$old_exactLocation || $$regCode != $$old_regCode || $$listingType != $$old_listingType) { /* convert otherCity, otherStateID to cityID */ /* MAB 9/26/99 - removed this next section for consistency with inserts */ /* $sql = "SELECT * from City where city='$$cityname' and stateID=$$stateIDname"; */ /* $result = mysql($database, $sql); */ /* if (mysql_numrows($result)) { */ /* $cityID = mysql_result($result,0,"cityID"); */ /* } */ /* */ /* if we get this far, add otherCity to the City table, and return the new cityID */ /* else { */ /* $sql = "INSERT INTO City (cityID, city, stateID, dateEntered, dateModified) values ('', '$$cityname', $$otherStateID, '$now', '')"; */ /* $result = mysql($database, $sql); */ /* $cityID = mysql_insert_id(); */ /* } */ /* END REMOVE */ $fm = sprintf ("%02d", $$fmname); $fd = sprintf ("%02d", $$fdname); $fromDate = "" . $$fyname . "-$fm-$fd"; $tm = sprintf ("%02d", $$tmname); $td = sprintf ("%02d", $$tdname); $toDate = "" . $$tyname . "-$tm-$td"; $sql = "update SeminarDates set leader='${$leadername}', fromDate='$fromDate', toDate='$toDate', otherCity='${$cityname}', otherStateID=${$stateIDname}, datemodified='$now', cityID=0, metroRegionID=${$metroIDname}, exactLocation ='${$exactLocation}', regCode='${$regCode}', listingType='${$listingType}', processed=0 where seminarDatesID=${$seminarDatesIDname}"; # echo "$sql
\n"; $result = mysql($database, $sql); } /* if changed */ } /* else */ } /* else */ $e++; } /* while */ } /* if ($edit) */ if ($add) { $a=0; while ($a<=$how_many_adds) { $cityname = "otherCity_add$a"; # we assume that if they entered a city, they want to add the date. # we won't deduce (or create) a cityID now. the admin script that approves the date will do that. if ($$cityname) { $stateIDname = "otherStateID_add$a"; $countryIDname = "otherCountryID_add$a"; if ((!$$stateIDname && !$$countryIDname) || ($$stateIDname && $$countryIDname)) { $errors = "Some dates not added! (missing state or country, or both selected)"; } else { /* if country code chosen, we know it's not USA or Canada, otherwise they would've chosen a state/province-country. */ /* so, we'll need to create a State record with a blank description and this country code (unless it already exists) */ if ($$countryIDname) { $sql = "select stateID from State where state='' and countryID=${$countryIDname}"; $result = mysql($database, $sql); $num = mysql_numrows($result); if ($num) { $$stateIDname = mysql_result($result,$i,"stateID"); } /* if */ else { $sql = "insert into State values ('', '', '', ${$countryIDname}, '$now', '')"; $result = mysql($database, $sql); $$stateIDname = mysql_insert_id(); } /* else */ } /* if */ $now = Date("Y-m-d h:m:s"); $leadername = "leader_add$a"; $metroIDname = "metroID_add$a"; $exactLocation = "exactLocation_add$a"; $regCode = "regCode_add$a"; $listingType = "listingType_add$a"; if (!$$metroIDname) { $$metroIDname = 0; } $fyname = "fromYear_add$a"; $fmname = "fromMonth_add$a"; $fm = sprintf ("%02d", $$fmname); $fdname = "fromDay_add$a"; $fd = sprintf ("%02d", $$fdname); $fromDate = "" . $$fyname . "-$fm-$fd"; $tyname = "toYear_add$a"; $tmname = "toMonth_add$a"; $tm = sprintf ("%02d", $$tmname); $tdname = "toDay_add$a"; $td = sprintf ("%02d", $$tdname); $toDate = "" . $$tyname . "-$tm-$td"; $eyname = "exactYear_add$a"; $emname = "exactMonth_add$a"; $em = sprintf ("%02d", $$emname); $edname = "exactDay_add$a"; $ed = sprintf ("%02d", $$edname); $exactDate = "" . $$eyname . "-$em-$ed"; $sql = "insert into SeminarDates values ('', $seminarID, '${$leadername}', '$fromDate', '$toDate', '${$cityname}', ${$stateIDname}, '', '', 0, '$now', '', 0, 0, ${$metroIDname},'${$exactLocation}', '${$regCode}', '${$listingType}')"; # echo "$sql
\n"; $result = mysql($database, $sql); $$cityname = ""; $$stateIDname = ""; $$countryIDname = ""; $$leadername = ""; $$metroIDname = ""; $$fyname = ""; $$fmname = ""; $$fdname = ""; $$tyname = ""; $$tmname = ""; $$tdname = ""; } /* else */ } /* if ($$cityname) */ $a++; } /* while */ } /* if ($add) */ } /* if (($edit || $add) && !$errors) */ if ($errors) { $errors = "
$errors
\n
\n"; } $sql = "select stateID, state, country from State, Country where state<>'' and (State.countryID = Country.countryID) order by state, country"; $result = mysql($database, $sql); $snum = mysql_numrows($result); $i=0; while ($i<$snum) { $stateIDs[$i] = mysql_result($result,$i,"stateID"); $states[$i] = mysql_result($result,$i,"state") . " - " . mysql_result($result,$i,"country"); $i++; } $sql = "select metroRegionID, metroRegion from MetroRegion order by metroRegion"; $result = mysql($database, $sql); $mnum = mysql_numrows($result); $i=0; while ($i<$mnum) { $metroIDs[$i] = mysql_result($result,$i,"metroRegionID"); $metros[$i] = mysql_result($result,$i,"metroRegion"); $i++; } $sql = "select countryID, country from Country where country<>'USA' and country<>'Canada' order by country"; $result = mysql($database, $sql); $cnum = mysql_numrows($result); $i=0; while ($i<$cnum) { $countryIDs[$i] = mysql_result($result,$i,"countryID"); $countries[$i] = mysql_result($result,$i,"country"); $i++; } $thisYear = Date("Y"); $template = File("moddatestemp.html"); $i=0; while ($i\n"; echo "\n"; echo "Return to main admin page

\n"; echo "Add dates for this seminar

\n"; echo "Modify Existing Public Dates:
 \n"; echo "\n"; $d=0; $bgcolor=""; while ($d<$dnum) { echo "\n"; if ($bgcolor != "#CCCCCC") { $bgcolor = "#CCCCCC"; } else { $bgcolor = "#FFFFFF"; } echo "\n"; echo "\n\n"; echo "\n"; $name = "otherCity_edit$d"; echo "\n"; echo "\n"; echo "\n\n"; $name = "otherStateID_edit$d"; echo "\n"; echo "\n"; echo "\n\n"; $name = "metroID_edit$d"; echo "\n"; echo "\n"; echo "\n\n"; $name = "leader_edit$d"; echo "\n"; echo "\n"; echo "\n\n"; $name = "exactLocation_edit$d"; echo "\n"; echo "\n"; echo "\n\n"; $name = "regCode_edit$d"; echo "\n"; echo "\n"; /* echo "\n\n"; $name = "listingType_edit$d"; echo "\n"; echo "\n"; */ $fromDate = mysql_result($result,$d,"fromDate"); echo "\n\n"; $name = "fromMonth_edit$d"; $$name = 0 + substr($fromDate,5,2); echo "\n"; echo "\n"; $toDate = mysql_result($result,$d,"toDate"); echo "\n\n"; $name = "toMonth_edit$d"; $$name = 0 + substr($toDate,5,2); echo "\n"; echo "\n"; echo "\n\n"; echo "\n"; echo "\n
City:\n"; echo "
State/Province
OR
Country:

\n"; echo ""; echo "  OR
\n"; $name = "otherCountryID_edit$d"; echo "
Metro Region:"; echo ""; echo "
Course Leader:"; echo "
Exact Location:"; echo "
Reg Code:"; echo "
Listing Type:"; echo "
From Date:\n"; $name = "fromDay_edit$d"; $$name = 0 + substr($fromDate,8,2); echo " \n"; $name = "fromYear_edit$d"; $$name = substr($fromDate,0,4); echo "
To Date:\n"; $name = "toDay_edit$d"; $$name = 0 + substr($toDate,8,2); echo " \n"; $name = "toYear_edit$d"; $$name = substr($toDate,0,4); echo "
Delete:
\n"; echo "\n"; $d++; } echo "\n"; echo "
 

\n


\n
\n\n"; echo "\n"; } } elseif ($template[$i] == "[adds]\n") { $a=1; $bgcolor=""; while ($a <= $how_many_adds) { if ($bgcolor != "#CCCCCC") { $bgcolor = "#CCCCCC"; } else { $bgcolor = "#FFFFFF"; } echo "\n"; echo "\n\n"; echo "\n"; $name = "otherCity_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "otherStateID_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "metroID_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "leader_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "exactLocation_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "regCode_add$a"; echo "\n"; echo "\n"; /* echo "\n\n"; $name = "listingType_add$a"; echo "\n"; echo "\n"; */ echo "\n\n"; $name = "fromMonth_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "toMonth_add$a"; echo "\n"; echo "\n"; echo "\n\n"; $name = "exactMonth_add$a"; echo "\n"; echo "\n"; */ echo "
City:
States/Province
OR
Country:

\n"; echo "  OR
\n"; $name = "otherCountryID_add$a"; echo "
Metro Region:
Course Leader:
Exact Location:
Reg Code:
Listing Type:
From Date:\n"; $name = "fromDay_add$a"; echo " \n"; $name = "fromYear_add$a"; echo "
To Date:\n"; $name = "toDay_add$a"; echo " \n"; $name = "toYear_add$a"; echo "
Exact Date:\n"; $name = "exactDay_add$a"; echo " \n"; $name = "exactYear_add$a"; echo "
\n"; echo "\n"; $a++; } } else { echo "$template[$i]\n"; } $i++; } ?>