diff options
| author | Horus3 | 2014-09-18 16:40:44 +0200 |
|---|---|---|
| committer | Horus3 | 2014-09-18 16:40:44 +0200 |
| commit | 11d8a116c70cd5eb49edb8afce34a0aaac49f35e (patch) | |
| tree | c94e0be77677e77e6f0c3131c0e8a4810471013f /public_html/class/mysql.php | |
| parent | f39735adc85901a3a2db83d16334ffff66960f65 (diff) | |
| download | vfs-11d8a116c70cd5eb49edb8afce34a0aaac49f35e.tar.gz | |
setup.php
Diffstat (limited to 'public_html/class/mysql.php')
| -rw-r--r-- | public_html/class/mysql.php | 13 |
1 files changed, 7 insertions, 6 deletions
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("<p>Can't set UTF-8 as a charset on your MySQL server." , '500 Server Failure', false, "<h1>Setting Charset failed!</h1>"); + failure("<p>Can't set UTF-8 as a charset on your MySQL server.</p>" , '500 Server Failure', false, "<h1>Setting Charset failed!</h1>"); } } @@ -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("<p>Setting up the database failed.</p>", '500 Server Failure', false, "<h1>CREATE TABLE FAILED"); |
