From eaa735da68d0ccdc30063152ae5404d73d0c8dbb Mon Sep 17 00:00:00 2001 From: Furentes Date: Tue, 14 May 2019 12:17:00 +0200 Subject: [PATCH] Fixed setup error Fixed db structure --- lib/autoload.php | 6 +++--- lib/sql/db.sql | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/autoload.php b/lib/autoload.php index a8114ad..cb9579f 100644 --- a/lib/autoload.php +++ b/lib/autoload.php @@ -22,8 +22,8 @@ if(@include(__DIR__."/config.php")) { if(!($request_uri == "/setup")) { $pdo = new \PDO('mysql:dbname='.DB_NAME.';host='.DB_HOST.';charset=utf8mb4', DB_USER, DB_PASS); $auth = new \Bloggr\Auth($pdo); -} -if ($auth->isLoggedIn()) { - echo 'Eingeloggt als '.$auth->getUsernameById($auth->getId()).''; + if ($auth->isLoggedIn()) { + echo 'Eingeloggt als '.$auth->getUsernameById($auth->getId()).''; + } } diff --git a/lib/sql/db.sql b/lib/sql/db.sql index 996c537..4dd8924 100644 --- a/lib/sql/db.sql +++ b/lib/sql/db.sql @@ -17,10 +17,11 @@ CREATE TABLE IF NOT EXISTS `users` ( -- CREATE TABLE `posts` ( - `id` int(11) UNSIGNED NOT NULL, + `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `user` int(11) UNSIGNED NOT NULL, `title` varchar(128) CHARACTER SET utf8mb4 NOT NULL, `text` longtext CHARACTER SET utf8mb4 NOT NULL, `created_at` int(10) UNSIGNED NOT NULL, - `updated_at` int(10) UNSIGNED DEFAULT NULL + `updated_at` int(10) UNSIGNED DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;