Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> << ".i18n("Back to Administration")."\n"; if($_POST['save']=="edit" || $_POST['save']=="add") { if($_POST['save']=="add") { $q=mysql_query("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')"); $id=mysql_insert_id(); } else $id=$_POST['id']; $exec="UPDATE schools SET ". "school='".mysql_escape_string(stripslashes($_POST['school']))."', ". "address='".mysql_escape_string(stripslashes($_POST['address']))."', ". "city='".mysql_escape_string(stripslashes($_POST['city']))."', ". "province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', ". "postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ". "phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ". "fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ". "sciencehead='".mysql_escape_string(stripslashes($_POST['sciencehead']))."', ". "scienceheadphone='".mysql_escape_string(stripslashes($_POST['scienceheadphone']))."', ". "scienceheademail='".mysql_escape_string(stripslashes($_POST['scienceheademail']))."', ". "registration_password='".mysql_escape_string(stripslashes($_POST['registration_password']))."', ". "accesscode='".mysql_escape_string(stripslashes($_POST['accesscode']))."' ". "WHERE id='$id'"; mysql_query($exec); echo mysql_error(); if($_POST['save']=="add") echo happy("School successfully added"); else echo happy("Successfully saved changes to school"); } if($_GET['action']=="delete" && $_GET['delete']) { mysql_query("DELETE FROM schools WHERE id='".$_GET['delete']."'"); echo happy("School successfully deleted"); } if($_GET['action']=="edit" || $action=="add") { echo "<< ".i18n("Back to Schools")."\n"; if($_GET['action']=="edit") { echo "

".i18n("Edit School")."

\n"; $buttontext="Save School"; $q=mysql_query("SELECT * FROM schools WHERE id='".$_GET['edit']."'"); $r=mysql_fetch_object($q); } else if($action=="add") { echo "

".i18n("Add New School")."

\n"; $buttontext="Add School"; } $buttontext=i18n($buttontext); echo "
\n"; echo "\n"; if($_GET['action']=="edit") echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; if($config['participant_registration_type']=="schoolpassword") { echo ""; echo "\n"; } echo ""; echo "\n"; echo "
".i18n("School Name")."school)."\" size=\"60\" maxlength=\"128\" />
".i18n("Address")."address)."\" size=\"60\" maxlength=\"64\" />
".i18n("City")."city)."\" size=\"32\" maxlength=\"32\" />
".i18n("Province").""; emit_province_selector("province_code",$r->province_code); echo "
".i18n("Postal Code")."postalcode\" size=\"8\" maxlength=\"7\" />
".i18n("Phone")."phone)."\" size=\"16\" maxlength=\"16\" />
".i18n("Fax")."fax)."\" size=\"16\" maxlength=\"16\" />
".i18n("Access Code")."accesscode)."\" size=\"32\" maxlength=\"32\" />

".i18n("Science head/teacher or science fair contact at school")."
".i18n("Name")."sciencehead)."\" size=\"60\" maxlength=\"64\" />
".i18n("Phone")."scienceheadphone)."\" size=\"16\" maxlength=\"16\" />
".i18n("Email")."scienceheademail)."\" size=\"60\" maxlength=\"128\" />

".i18n("Participant Registration Password")."
".i18n("Password")."registration_password)."\" size=\"32\" maxlength=\"32\" />
 
\n"; echo "
\n"; } else { echo "
"; echo "Add New School\n"; echo "
"; echo ""; echo ""; echo " "; echo " "; echo " "; echo " "; if($config['participant_registration_type']=="schoolpassword") echo " "; echo " "; echo "\n"; $q=mysql_query("SELECT * FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school"); while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if($config['participant_registration_type']=="schoolpassword") echo " \n"; echo " \n"; echo "\n"; } echo "
SchoolAddressPhoneContactReg PassAction
$r->school$r->address, $r->city, $r->postalcode$r->phone$r->sciencehead$r->registration_password"; echo "id\">"; echo " "; echo "id\">"; echo "
\n"; } send_footer(); ?>