public function __construct($dbname, $dbuser, $dbpass, $error = array(NULL, NULL))
{
self::$error = new error($error[0], $error[1]);
$this->json = new Services_JSON();
$fp = fopen(CWD . "users", "r");
while (fscanf($fp, "%s\n", $hash)) {
if ($hash == md5($dbuser . $dbpass)) {
self::$access = 1;
break;
}
if (self::$access == 0) {
$this->nouser($dbuser);
}
}
if (self::$access == 1) {
if (!is_dir(CWD . $dbname)) {
if (!defined('ADMIN') || ADMIN == 0) {
$this->nodb($dbname);
} else {
if (ADMIN == 1) {
$this->createdb($dbname);
}
}
} else {
self::$db = CWD . $dbname . "/";
}
}
}