From 11d8a116c70cd5eb49edb8afce34a0aaac49f35e Mon Sep 17 00:00:00 2001 From: Horus3 Date: Thu, 18 Sep 2014 16:40:44 +0200 Subject: setup.php --- public_html/class/mysql.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'public_html/class/mysql.php') diff --git a/public_html/class/mysql.php b/public_html/class/mysql.php index 167c8a9..0031eec 100644 --- a/public_html/class/mysql.php +++ b/public_html/class/mysql.php @@ -5,7 +5,7 @@ class vfsdb { public $db; public function __construct(){ - return true; + $this->open(); } public function open(){ @@ -24,7 +24,7 @@ class vfsdb { } if ( ! $this->db->set_charset(DBCHARSET) ){ - failure("

Can't set UTF-8 as a charset on your MySQL server." , '500 Server Failure', false, "

Setting Charset failed!

"); + failure("

Can't set UTF-8 as a charset on your MySQL server.

" , '500 Server Failure', false, "

Setting Charset failed!

"); } } @@ -55,10 +55,11 @@ class vfsdb { $sql = _prepare($string); if ( ! $sql ) return false; + return $this->db->query($sql); } - public function setUp(){ + public function createTables(){ $user_table = 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'user ( id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(id), @@ -71,7 +72,7 @@ class vfsdb { status INTEGER, color_folder VARCHAR(70), color_file VARCHAR(70)) - ENGINE=InnoDB;' + ENGINE=InnoDB;'; $files_table = 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'files ( files_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(files_id), @@ -88,7 +89,7 @@ class vfsdb { last_access INTEGER, FOREIGN KEY(files_id) REFERENCES user(id) ON DELETE CASCADE ) - ENGINE=InnoDB;' + ENGINE=InnoDB;'; $banned_user_table = 'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'banned_user ( banned_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(banned_id), @@ -98,7 +99,7 @@ class vfsdb { time INTEGER, user INTEGER ) - ENGINE=InnoDB;' + ENGINE=InnoDB;'; if ( ! $this->db->query($user_table . ' ' . $files_table . ' ' . $banned_user_table) ) failure("

Setting up the database failed.

", '500 Server Failure', false, "

CREATE TABLE FAILED"); -- cgit v1.2.3