summaryrefslogtreecommitdiffstats
path: root/include/db.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2010-03-13 11:52:36 -0800
committerArun Persaud <arun@nubati.net>2010-03-13 16:05:34 -0800
commitcf764594cd00e66ee812c5d63b016bf286178f67 (patch)
treecd8ae9fa7bdd80ea5d0746bb85921ab2d416452a /include/db.php
parentfceb0d9bc48ae848461e728abaf5065a2578da61 (diff)
downloade-DoKo-cf764594cd00e66ee812c5d63b016bf286178f67.tar.gz
e-DoKo-cf764594cd00e66ee812c5d63b016bf286178f67.tar.bz2
e-DoKo-cf764594cd00e66ee812c5d63b016bf286178f67.zip
added check in DB_open for correct DB-version
Diffstat (limited to 'include/db.php')
-rw-r--r--include/db.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/db.php b/include/db.php
index b79da87..5503a4a 100644
--- a/include/db.php
+++ b/include/db.php
@@ -30,17 +30,24 @@ if(!isset($HOST))
function DB_open()
{
+ $version_needed = 1;
+
global $DB,$DB_user,$DB_host,$DB_database,$DB_password;
$DB = @mysql_connect($DB_host,$DB_user, $DB_password);
if ( $DB )
{
- mysql_select_db($DB_database) or die('Could not select database');
+ mysql_select_db($DB_database) or die('Error: Could not select database');
}
else
{
echo mysql_errno() . ": " . mysql_error(). "\n";
return -1;
- }
+ };
+
+ $version = DB_get_version();
+ if ($version != $version_needed)
+ return -2;
+
return 0;
}