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. */ ?> "; if(file_exists($prependdir."../../data/config.inc.php")) { require_once($prependdir."../../data/config.inc.php"); } else { echo "SFIAB is not setup. Do that prior to starting plug-ins
"; exit; } $DBUSER=substr($DBUSER,0,16); if(!mysql_connect($DBHOST,$DBUSER,$DBPASS)) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "Cannot connect to database!"; echo ""; exit; } if(!mysql_select_db($DBNAME)) { echo "SFIAB ERROR"; echo "

Science Fair In A Box - ERROR

"; echo "Cannot select database!"; echo ""; exit; } } //find out the fair year and any other 'year=0' configuration parameters (things that dont change as the years go on) $q=@mysql_query("SELECT * FROM config WHERE year='0'"); //we might get an error if installation step 2 is not done (ie, the config table doesnt even exist) if(mysql_error()) { echo "SFIAB installation is not complete. Plug-ins require a complete installation!"; echo "
"; exit; } //if we have 0 (<1) then install2 is not done, which would get caught above, //if we have 1 (<2) then insatll3 is not done (no entries for FAIRYEAR and SFIABDIRECTORY) if(mysql_num_rows($q)<2) { echo "SFIAB installation is not complete. Plug-ins require a complete installation!"; echo "
"; exit; } else { if (!config) { while($r=mysql_fetch_object($q)) { $config[$r->var]=$r->val; } } } //now pull the rest of the configuration $q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."'"); while($r=mysql_fetch_object($q)) { $config[$r->var]=$r->val; } //now pull the dates probably not required in plug-ins keep for now $q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."'"); while($r=mysql_fetch_object($q)) { $config['dates'][$r->name]=$r->date; } ?>