diff --git a/admin/add-category-logic.php b/admin/add-category-logic.php new file mode 100644 index 0000000..6736e84 --- /dev/null +++ b/admin/add-category-logic.php @@ -0,0 +1,36 @@ +

Add Category

+
-

This is an error message

+

-
- - + + + + - +
diff --git a/admin/add-post-logic.php b/admin/add-post-logic.php new file mode 100644 index 0000000..e0013af --- /dev/null +++ b/admin/add-post-logic.php @@ -0,0 +1,84 @@ + \ No newline at end of file diff --git a/admin/add-post.php b/admin/add-post.php index 7940d09..a4c3a1d 100644 --- a/admin/add-post.php +++ b/admin/add-post.php @@ -1,5 +1,15 @@ @@ -7,35 +17,40 @@ include "partials/header.php";

Add Post

+
-

This is an error message

+

+ +

-
- - + +
- +
- + +
- +
- +
\ No newline at end of file +include '../partials/footer.php'; +?> diff --git a/admin/add-user-logic.php b/admin/add-user-logic.php new file mode 100644 index 0000000..45d96ea --- /dev/null +++ b/admin/add-user-logic.php @@ -0,0 +1,98 @@ +0){ + $_SESSION['add-user'] = "Username or Email already exists"; + }else{ + //WORK ON AVATAR + //rename avatar + $time = time(); // make each image name unique using current timestamp + $avatar_name = $time . $avatar['name']; + $avatar_tmp_name=$avatar['tmp_name']; + $avatar_destination_path='../images/' . $avatar_name; + + //,ake sure file is an image + $allowed_files = ['png', 'jpg', 'jpeg']; + $extension = explode('.', $avatar_name); + $extension = end($extension); + + if(in_array($extension,$allowed_files)){ + + //if image not too large + if($avatar['size']<1000000){ + + //upload avatar + move_uploaded_file($avatar_tmp_name, $avatar_destination_path); + }else{ + $_SESSION['add-user']="Folder size too big.Should be less than 1mb"; + } + }else{ + $_SESSION['add-user']="File should be png, jpg or jpeg"; + } + } + + + + } + } + // redirect back t add-user on error + if(isset($_SESSION['add-user'])){ + // pass data back to sign up page + $_SESSION['add-user-data'] = $_POST; + header('location: ' . ROOT_URL . 'admin/add-user.php'); + die(); + + }else{ + //insert new user into users table + $inset_user_query = "INSERT INTO users SET firstname ='$firstname' ,lastname='$lastname',username='$username',email ='$email' ,password='$hashed_password',avatar='$avatar_name',is_admin='$is_admin'"; + $inset_user_result = mysqli_query($connection, $inset_user_query); + if(!mysqli_errno($connection)){ + $_SESSION['add-user-success'] = "Registration Successful"; + header('location: ' . ROOT_URL . 'admin/manage-users.php'); + die(); + } + } +}else{ + //button not clicked + header('location: ' . ROOT_URL . "admin/add-user.php"); + die(); +} \ No newline at end of file diff --git a/admin/add-user.php b/admin/add-user.php index 8857b43..43923b6 100644 --- a/admin/add-user.php +++ b/admin/add-user.php @@ -1,22 +1,57 @@

Add User

-
-

This is an error message

+ + + +
+

+ +

-
- - - - - - - + + + + + +
- +
- +
@@ -36,5 +71,5 @@ include "partials/header.php"; \ No newline at end of file diff --git a/admin/delete-category.php b/admin/delete-category.php new file mode 100644 index 0000000..fafc99f --- /dev/null +++ b/admin/delete-category.php @@ -0,0 +1,27 @@ + diff --git a/admin/delete-post.php b/admin/delete-post.php new file mode 100644 index 0000000..29d8835 --- /dev/null +++ b/admin/delete-post.php @@ -0,0 +1,36 @@ +1){ + while($thumbnail=mysqli_fetch_assoc($thumbnails_result)){ + $thumbnail_path="../images/" . $thumbnail['thumbnail']; + if($thumbnail_path){ + unlink($thumbnail_path); + } + } + } + + + + + + // delete user from database + $delete_user_query = "DELETE FROM users WHERE id = $id"; + $delete_user_result = mysqli_query($connection, $delete_user_query); + if(mysqli_errno($connection)){ + $_SESSION['delete-user']="Couldn't delete '{$user['firstname']}' '{$user['lastname']}'"; + + } else{ + $_SESSION['delete-user-success']="'{$user['firstname']} {$user['lastname']}' has been deleted successfully"; + + } +} +header("location: " . ROOT_URL . "admin/manage-users.php"); +die(); \ No newline at end of file diff --git a/admin/edit-category-logic.php b/admin/edit-category-logic.php new file mode 100644 index 0000000..a273cc9 --- /dev/null +++ b/admin/edit-category-logic.php @@ -0,0 +1,25 @@ +
-
+

Edit Category

-
- - + + + + - +
diff --git a/admin/edit-post-logic.php b/admin/edit-post-logic.php new file mode 100644 index 0000000..e2c3100 --- /dev/null +++ b/admin/edit-post-logic.php @@ -0,0 +1,84 @@ +

Edit Post

- -
- - + + + +
- +
- + +
- - + +
- +
diff --git a/admin/edit-user-logic.php b/admin/edit-user-logic.php new file mode 100644 index 0000000..ab81d80 --- /dev/null +++ b/admin/edit-user-logic.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/admin/edit-user.php b/admin/edit-user.php index d94dc08..776741b 100644 --- a/admin/edit-user.php +++ b/admin/edit-user.php @@ -1,21 +1,36 @@

Edit User

-
- - - + + + - +
diff --git a/admin/index.php b/admin/index.php index 0ece037..ca85cda 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,9 +1,60 @@
+ + +
+

+ +

+
+ + +
+

+ +

+
+ + +
+

+ +

+
+ + +
+

+ +

+
+ + +
+

+ +

+
+
@@ -56,35 +107,37 @@ include "partials/header.php";

Manage Posts

+ 0 ): ?> + + + + - - - - - - - - - - - - - - - - - - + + + + + + + +
+
TitleCategory Edit Delete
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quo, minus.EditDelete
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore, corrupti!EditDelete
Lorem ipsum dolor sit amet elit. Distinctio, quibusdam!EditDelete
Lorem ipsum dolor sit amet consectetur, adipisicing elit.EditDeleteEditDelete
diff --git a/admin/manage-categories.php b/admin/manage-categories.php index 2b349da..17cf6d7 100644 --- a/admin/manage-categories.php +++ b/admin/manage-categories.php @@ -1,9 +1,54 @@
+ +
+

+ +

+ +
+ +
+

+ +

+ +
+ + +
+

+ +

+ +
+ +
+

+ +

+ +
+
@@ -55,6 +100,7 @@ include "partials/header.php";

Manage Categories

+ 0) : ?> @@ -64,22 +110,19 @@ include "partials/header.php"; + - - - - - - - - - - - - - + + + + + +
+ No categories found +
+
TravelEditDelete
MusicEditDelete
Wild LifeEditDeleteEditDelete
diff --git a/admin/manage-users.php b/admin/manage-users.php index 73f736e..3cb7c5e 100644 --- a/admin/manage-users.php +++ b/admin/manage-users.php @@ -1,9 +1,71 @@
+ +
+

+ +

+ +
+ +
+

+ +

+ +
+ +
+

+ +

+ +
+ +
+

+ +

+ +
+ +
+

+ +

+ +
+
@@ -56,6 +118,7 @@ include "partials/header.php";

Manage Users

+ 0): ?> @@ -67,31 +130,23 @@ include "partials/header.php"; + + + + + + + - - - - - - - - - - - - - - - - - - - +
EditDelete
Named GuyNamed EditDeleteYes
Vinland Saga Saga EditDeleteNo
Pikachu GuyGuy EditDeleteYes
+ +
No users found
+
diff --git a/blog.php b/blog.php index f2ea865..4097c90 100644 --- a/blog.php +++ b/blog.php @@ -1,12 +1,26 @@
-
+
- - + +
@@ -16,305 +30,68 @@ include 'partials/header.php' - -
+
">
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
-
+ +
diff --git a/category-posts.php b/category-posts.php index 4155a5c..6f08e6e 100644 --- a/category-posts.php +++ b/category-posts.php @@ -1,312 +1,99 @@ -
-

Category Title

-
+
+ + +

+
+ + 0) : ?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
- + +
+

+ No posts found for this category +

+
+
- -
+
+ + + + +
+
diff --git a/css/style.css b/css/style.css index 11092e5..6857229 100644 --- a/css/style.css +++ b/css/style.css @@ -458,7 +458,9 @@ footer ul a:hover{ display: grid; place-content: center; } - +.post_info{ + align-items: left; +} /*======================================================================================= diff --git a/images/1677834448avatar15.jpg b/images/1677834448avatar15.jpg new file mode 100644 index 0000000..f54deb5 Binary files /dev/null and b/images/1677834448avatar15.jpg differ diff --git a/images/1677835117avatar7.jpg b/images/1677835117avatar7.jpg new file mode 100644 index 0000000..3b271db Binary files /dev/null and b/images/1677835117avatar7.jpg differ diff --git a/images/1677835502blog102.jpg b/images/1677835502blog102.jpg new file mode 100644 index 0000000..f2c7126 Binary files /dev/null and b/images/1677835502blog102.jpg differ diff --git a/images/1677835638blog15.jpg b/images/1677835638blog15.jpg new file mode 100644 index 0000000..2682b92 Binary files /dev/null and b/images/1677835638blog15.jpg differ diff --git a/images/1677835680avatar3.jpg b/images/1677835680avatar3.jpg new file mode 100644 index 0000000..0131300 Binary files /dev/null and b/images/1677835680avatar3.jpg differ diff --git a/images/1677835859blog20.jpg b/images/1677835859blog20.jpg new file mode 100644 index 0000000..c41d59a Binary files /dev/null and b/images/1677835859blog20.jpg differ diff --git a/images/1677835925avatar1.jpg b/images/1677835925avatar1.jpg new file mode 100644 index 0000000..892b6c3 Binary files /dev/null and b/images/1677835925avatar1.jpg differ diff --git a/images/1677836026blog13.jpg b/images/1677836026blog13.jpg new file mode 100644 index 0000000..328de18 Binary files /dev/null and b/images/1677836026blog13.jpg differ diff --git a/index.php b/index.php index 30ec777..fc71ac6 100644 --- a/index.php +++ b/index.php @@ -1,328 +1,124 @@ - -
diff --git a/search.php b/search.php new file mode 100644 index 0000000..434406c --- /dev/null +++ b/search.php @@ -0,0 +1,86 @@ + + + 0)) : ?> +
+ +
+ +
+
+ +
+ + +
+ + +
+
+ +
+

No post found for this search

+
+ + +
+
+ + + + +
+
+ + \ No newline at end of file diff --git a/signin-logic.php b/signin-logic.php index 161cdf1..7b9adb6 100644 --- a/signin-logic.php +++ b/signin-logic.php @@ -1,7 +1,6 @@

Sign In

- - - - -
+ +

-

-
- + +
+ + diff --git a/signup.php b/signup.php index 389c39a..9b25d89 100644 --- a/signup.php +++ b/signup.php @@ -1,5 +1,5 @@