val; if(!$dbdbversion) { echo "Couldnt get current db version. Is SFIAB properly installed?\n"; exit; } if($dbcodeversion && $dbdbversion) { //lets see if they match if($dbcodeversion == $dbdbversion) { echo "DB and CODE are all up-to-date. Version: $dbdbversion\n"; exit; } else if($dbcodeversion<$dbdbversion) { echo "ERROR: dbcodeversion$dbdbversion) { echo "DB update requirements detected\n"; echo "Current DB Version: $dbdbversion\n"; echo "Current CODE Version: $dbcodeversion\n"; echo "Updating database from $dbdbversion to $dbcodeversion\n"; for($ver=$dbdbversion+1;$ver<=$dbcodeversion;$ver++) { if(file_exists("db.update.$ver.sql")) { echo "db.update.$ver.sql detected - running...\n"; readfile("db.update.$ver.sql"); echo "\n"; system("mysql -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME