diff options
| author | Horus3 | 2014-02-19 22:15:19 +0100 |
|---|---|---|
| committer | Horus3 | 2014-02-19 22:15:19 +0100 |
| commit | 786428a5f2636c189e97111f7b706a5e0e4b6f30 (patch) | |
| tree | fe54e74f644d559166f3fc6c85678d178276d908 /www/setup.php | |
| parent | 56a9e2810315757f200b904c56694319a69fd321 (diff) | |
| download | files.iamfabulous.de-786428a5f2636c189e97111f7b706a5e0e4b6f30.tar.gz | |
Changed database schema again.
Diffstat (limited to 'www/setup.php')
| -rw-r--r-- | www/setup.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/www/setup.php b/www/setup.php index 00aa9ed..a67bd54 100644 --- a/www/setup.php +++ b/www/setup.php @@ -1,6 +1,6 @@ <? -/*Sets up the database with the user table. Add ?drop to drop _everything_*/ +/*Sets up the database with the necessary tables. Add ?drop to drop _everything_*/ $db = new SQLite3("../database/sqlite.db"); @@ -14,7 +14,7 @@ if($bool){ if($db->exec(" BEGIN TRANSACTION; PRAGMA writable_schema = 1; - delete from sqlite_master where type = 'table'; + DELETE FROM sqlite_master WHERE type = 'table'; PRAGMA writable_schema = 0; COMMIT; VACUUM;") @@ -25,6 +25,7 @@ if($bool){ } } else { $cleartext_password="password"; + $email="admin@iamfabulous.de"; $salt = uniqid(mt_rand(), true); $password = "$salt"."$cleartext_password"; $hash_password = md5($password); @@ -35,7 +36,9 @@ if($bool){ if($db->exec(" BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS user (id INTEGER PRIMARY KEY, name TEXT UIQUE, senpai INTEGER, key TEXT, status INTEGER, invites INTEGER, salt TEXT, password TEXT, email TEXT UNIQUE); - INSERT INTO user (id, name, senpai, key, status, invites, salt, password, email) VALUES (NULL, 'admin', 0, '11111', 1, 5, '$salt', '$hash_password', 'admin@iamfabulous.de'); + INSERT INTO user (id, name, senpai, key, status, invites, salt, password, email) VALUES (NULL, 'admin', 0, '11111', 1, 5, '$salt', '$hash_password', '$email'); + CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, parent INTEGER, owner INTEGER, name TEXT, folder TEXT, mime TEXT, size INTEGER, share TEXT, extra TEXT, FOREIGN KEY(owner) REFERENCES user(id)); + CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY, user INTEGER, login TEXT, FOREIGN KEY(user) REFERENCES user(id)); COMMIT;") ) { echo "Success!"; |
