diff --git a/admin/auth.php b/admin/auth.php
new file mode 100644
index 0000000..fb04e2d
--- /dev/null
+++ b/admin/auth.php
@@ -0,0 +1,7 @@
+prepare("INSERT INTO posts (user_id, title, content, slug) VALUES (?, ?, ?, ?)");
+ $stmt->execute([$_SESSION['user_id'], $title, $content, $slug]);
+
+ header('Location: posts.php');
+ exit;
+}
+?>
+
+
Create Post
+
+
+
+
diff --git a/admin/delete_post.php b/admin/delete_post.php
new file mode 100644
index 0000000..ef221c0
--- /dev/null
+++ b/admin/delete_post.php
@@ -0,0 +1,21 @@
+prepare("SELECT * FROM posts WHERE id = ? AND user_id = ?");
+$stmt->execute([$id, $_SESSION['user_id']]);
+$post = $stmt->fetch();
+
+if ($post) {
+ $stmt = db()->prepare("DELETE FROM posts WHERE id = ?");
+ $stmt->execute([$id]);
+}
+
+header('Location: posts.php');
+exit;
diff --git a/admin/edit_post.php b/admin/edit_post.php
new file mode 100644
index 0000000..0e720d7
--- /dev/null
+++ b/admin/edit_post.php
@@ -0,0 +1,48 @@
+prepare("SELECT * FROM posts WHERE id = ? AND user_id = ?");
+$stmt->execute([$id, $_SESSION['user_id']]);
+$post = $stmt->fetch();
+
+if (!$post) {
+ header('Location: posts.php');
+ exit;
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $title = $_POST['title'];
+ $content = $_POST['content'];
+ $slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $title)));
+
+ $stmt = db()->prepare("UPDATE posts SET title = ?, content = ?, slug = ? WHERE id = ?");
+ $stmt->execute([$title, $content, $slug, $id]);
+
+ header('Location: posts.php');
+ exit;
+}
+?>
+
+Edit Post
+
+
+
+
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..dd4baf2
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,11 @@
+
+
+Admin Dashboard
+Welcome, !
+
+Manage Posts
+
+
diff --git a/admin/posts.php b/admin/posts.php
new file mode 100644
index 0000000..ec4d21a
--- /dev/null
+++ b/admin/posts.php
@@ -0,0 +1,36 @@
+prepare("SELECT * FROM posts WHERE user_id = ? ORDER BY created_at DESC");
+$stmt->execute([$_SESSION['user_id']]);
+$posts = $stmt->fetchAll();
+?>
+
+Manage Posts
+Create Post
+
+
+
+
+ | Title |
+ Created At |
+ Actions |
+
+
+
+
+
+ |
+ |
+
+ Edit
+ Delete
+ |
+
+
+
+
+
+
diff --git a/db/migrate.php b/db/migrate.php
new file mode 100644
index 0000000..6c09352
--- /dev/null
+++ b/db/migrate.php
@@ -0,0 +1,12 @@
+exec($sql);
+ echo "Migration successful!\n";
+} catch (PDOException $e) {
+ die("Migration failed: " . $e->getMessage() . "\n");
+}
+
diff --git a/db/migrations/001_create_users_and_posts_tables.sql b/db/migrations/001_create_users_and_posts_tables.sql
new file mode 100644
index 0000000..84a6d9d
--- /dev/null
+++ b/db/migrations/001_create_users_and_posts_tables.sql
@@ -0,0 +1,23 @@
+CREATE TABLE IF NOT EXISTS `users` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `username` varchar(50) NOT NULL,
+ `password` varchar(255) NOT NULL,
+ `email` varchar(100) NOT NULL,
+ `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `username` (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `posts` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `user_id` int(11) NOT NULL,
+ `title` varchar(255) NOT NULL,
+ `slug` varchar(255) NOT NULL,
+ `content` text NOT NULL,
+ `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
+ `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `slug` (`slug`),
+ KEY `user_id` (`user_id`),
+ CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/includes/footer.php b/includes/footer.php
new file mode 100644
index 0000000..5c46507
--- /dev/null
+++ b/includes/footer.php
@@ -0,0 +1,4 @@
+
+
+