Fix common.inc.php to properly detect whether installation needs to go to step 2 or step 3

This commit is contained in:
james 2005-06-07 21:07:52 +00:00
parent 6a9b470698
commit 79f3d7ead6

View File

@ -84,8 +84,21 @@ if(!mysql_select_db($DBNAME))
}
//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'");
if(!mysql_num_rows($q))
$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 "<html><head><title>SFIAB ERROR</title></head><body>";
echo "<h1>Science Fair In A Box - ERROR</h1>";
echo "SFIAB installation is not complete. Please go to <A href=\"install2.php\">Installer Step 2</a> to complete the installation process";
echo "<br>";
echo "</body></html>";
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 "<html><head><title>SFIAB ERROR</title></head><body>";
echo "<h1>Science Fair In A Box - ERROR</h1>";