From f0cbb618ec084c99e922634cd8814d02cfc1a6ce Mon Sep 17 00:00:00 2001 From: james Date: Fri, 27 May 2005 21:23:16 +0000 Subject: [PATCH] Move the db/code version check before the database connection in common.inc.php --- common.inc.php | 55 ++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/common.inc.php b/common.inc.php index 64883147..7b38cdfa 100644 --- a/common.inc.php +++ b/common.inc.php @@ -65,6 +65,30 @@ else exit; } +//first things first - make sure our DB version matches our CODE version +$dbcodeversion=@file("db/db.code.version.txt"); +$dbdbversion=@file("db/db.db.version.txt"); +if($dbcodeversion[0]!=$dbdbversion[0]) +{ + echo "SFIAB ERROR"; + echo "

Science Fair In A Box - ERROR

"; + echo "SFIAB database and code are mismatched"; + echo "
"; + echo "Please run the db_update.php script in order to update"; + echo "
"; + echo "your database to the same version as the code"; + echo "
"; + echo "
"; + echo "
"; + echo "

Details

"; + echo "Current SFIAB codebase requires DB version: ".$dbcodeversion[0]; + echo "
"; + echo "Current SFIAB database is detected as version: ".$dbdbversion[0]; + echo "
"; + echo ""; + exit; +} + if(!mysql_connect($DBHOST,$DBUSER,$DBPASS)) { echo "SFIAB ERROR"; @@ -104,39 +128,8 @@ while($r=mysql_fetch_object($q)) $config['dates'][$r->name]=$r->date; } - - - - -//first things first - make sure our DB version matches our CODE version -$dbcodeversion=@file("db/db.code.version.txt"); -$dbdbversion=@file("db/db.db.version.txt"); -if($dbcodeversion[0]!=$dbdbversion[0]) -{ - echo "SFIAB ERROR"; - echo "

Science Fair In A Box - ERROR

"; - echo "SFIAB database and code are mismatched"; - echo "
"; - echo "Please run the db_update.php script in order to update"; - echo "
"; - echo "your database to the same version as the code"; - echo "
"; - echo "
"; - echo "
"; - echo "

Details

"; - echo "Current SFIAB codebase requires DB version: ".$dbcodeversion[0]; - echo "
"; - echo "Current SFIAB database is detected as version: ".$dbdbversion[0]; - echo "
"; - echo ""; - exit; -} - - require_once("committee_auth.php"); - - session_start(); //detect the browser first, so we know what icons to use - we store this in the config array as well