├── .htaccess
├── app
├── .htaccess
├── config
│ └── config.php
├── controllers
│ ├── Pages.php
│ ├── Posts.php
│ └── Users.php
├── helpers
│ └── session_helper.php
├── libraries
│ ├── Controller.php
│ ├── Core.php
│ └── Database.php
├── models
│ ├── Post.php
│ └── User.php
├── require.php
└── views
│ ├── about.php
│ ├── includes
│ ├── head.php
│ └── navigation.php
│ ├── index.php
│ ├── posts
│ ├── create.php
│ ├── index.php
│ └── update.php
│ └── users
│ ├── login.php
│ └── register.php
└── public
├── .htaccess
├── css
└── style.css
├── img
└── banner.jpg
└── index.php
/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | RewriteEngine on
3 | RewriteRule ^$ public/ [L]
4 | RewriteRule (.*) public/$1 [L]
5 |
6 |
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 | Options -Indexes
2 |
--------------------------------------------------------------------------------
/app/config/config.php:
--------------------------------------------------------------------------------
1 | userModel = $this->model('User');
5 | }
6 |
7 | public function index() {
8 | $data = [
9 | 'title' => 'Home page'
10 | ];
11 |
12 | $this->view('index', $data);
13 | }
14 |
15 | public function about() {
16 | $this->view('about');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/controllers/Posts.php:
--------------------------------------------------------------------------------
1 | postModel = $this->model('Post');
5 | }
6 |
7 | public function index() {
8 | $posts = $this->postModel->findAllPosts();
9 |
10 | $data = [
11 | 'posts' => $posts
12 | ];
13 |
14 | $this->view('posts/index', $data);
15 | }
16 |
17 | public function create() {
18 | if(!isLoggedIn()) {
19 | header("Location: " . URLROOT . "/posts");
20 | }
21 |
22 | $data = [
23 | 'title' => '',
24 | 'body' => '',
25 | 'titleError' => '',
26 | 'bodyError' => ''
27 | ];
28 |
29 | if($_SERVER['REQUEST_METHOD'] == 'POST') {
30 | $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
31 |
32 | $data = [
33 | 'user_id' => $_SESSION['user_id'],
34 | 'title' => trim($_POST['title']),
35 | 'body' => trim($_POST['body']),
36 | 'titleError' => '',
37 | 'bodyError' => ''
38 | ];
39 |
40 | if(empty($data['title'])) {
41 | $data['titleError'] = 'The title of a post cannot be empty';
42 | }
43 |
44 | if(empty($data['body'])) {
45 | $data['bodyError'] = 'The body of a post cannot be empty';
46 | }
47 |
48 | if (empty($data['titleError']) && empty($data['bodyError'])) {
49 | if ($this->postModel->addPost($data)) {
50 | header("Location: " . URLROOT . "/posts");
51 | } else {
52 | die("Something went wrong, please try again!");
53 | }
54 | } else {
55 | $this->view('posts/create', $data);
56 | }
57 | }
58 |
59 | $this->view('posts/create', $data);
60 | }
61 |
62 | public function update($id) {
63 |
64 | $post = $this->postModel->findPostById($id);
65 |
66 | if(!isLoggedIn()) {
67 | header("Location: " . URLROOT . "/posts");
68 | } elseif($post->user_id != $_SESSION['user_id']){
69 | header("Location: " . URLROOT . "/posts");
70 | }
71 |
72 | $data = [
73 | 'post' => $post,
74 | 'title' => '',
75 | 'body' => '',
76 | 'titleError' => '',
77 | 'bodyError' => ''
78 | ];
79 |
80 | if($_SERVER['REQUEST_METHOD'] == 'POST') {
81 | $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
82 |
83 | $data = [
84 | 'id' => $id,
85 | 'post' => $post,
86 | 'user_id' => $_SESSION['user_id'],
87 | 'title' => trim($_POST['title']),
88 | 'body' => trim($_POST['body']),
89 | 'titleError' => '',
90 | 'bodyError' => ''
91 | ];
92 |
93 | if(empty($data['title'])) {
94 | $data['titleError'] = 'The title of a post cannot be empty';
95 | }
96 |
97 | if(empty($data['body'])) {
98 | $data['bodyError'] = 'The body of a post cannot be empty';
99 | }
100 |
101 | if($data['title'] == $this->postModel->findPostById($id)->title) {
102 | $data['titleError'] == 'At least change the title!';
103 | }
104 |
105 | if($data['body'] == $this->postModel->findPostById($id)->body) {
106 | $data['bodyError'] == 'At least change the body!';
107 | }
108 |
109 | if (empty($data['titleError']) && empty($data['bodyError'])) {
110 | if ($this->postModel->updatePost($data)) {
111 | header("Location: " . URLROOT . "/posts");
112 | } else {
113 | die("Something went wrong, please try again!");
114 | }
115 | } else {
116 | $this->view('posts/update', $data);
117 | }
118 | }
119 |
120 | $this->view('posts/update', $data);
121 | }
122 |
123 | public function delete($id) {
124 |
125 | $post = $this->postModel->findPostById($id);
126 |
127 | if(!isLoggedIn()) {
128 | header("Location: " . URLROOT . "/posts");
129 | } elseif($post->user_id != $_SESSION['user_id']){
130 | header("Location: " . URLROOT . "/posts");
131 | }
132 |
133 | $data = [
134 | 'post' => $post,
135 | 'title' => '',
136 | 'body' => '',
137 | 'titleError' => '',
138 | 'bodyError' => ''
139 | ];
140 |
141 | if($_SERVER['REQUEST_METHOD'] == 'POST') {
142 | $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
143 |
144 | if($this->postModel->deletePost($id)) {
145 | header("Location: " . URLROOT . "/posts");
146 | } else {
147 | die('Something went wrong!');
148 | }
149 | }
150 | }
151 | }
152 |
153 |
--------------------------------------------------------------------------------
/app/controllers/Users.php:
--------------------------------------------------------------------------------
1 | userModel = $this->model('User');
5 | }
6 |
7 | public function register() {
8 | $data = [
9 | 'username' => '',
10 | 'email' => '',
11 | 'password' => '',
12 | 'confirmPassword' => '',
13 | 'usernameError' => '',
14 | 'emailError' => '',
15 | 'passwordError' => '',
16 | 'confirmPasswordError' => ''
17 | ];
18 |
19 | if($_SERVER['REQUEST_METHOD'] == 'POST'){
20 | // Process form
21 | // Sanitize POST data
22 | $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
23 |
24 | $data = [
25 | 'username' => trim($_POST['username']),
26 | 'email' => trim($_POST['email']),
27 | 'password' => trim($_POST['password']),
28 | 'confirmPassword' => trim($_POST['confirmPassword']),
29 | 'usernameError' => '',
30 | 'emailError' => '',
31 | 'passwordError' => '',
32 | 'confirmPasswordError' => ''
33 | ];
34 |
35 | $nameValidation = "/^[a-zA-Z0-9]*$/";
36 | $passwordValidation = "/^(.{0,7}|[^a-z]*|[^\d]*)$/i";
37 |
38 | //Validate username on letters/numbers
39 | if (empty($data['username'])) {
40 | $data['usernameError'] = 'Please enter username.';
41 | } elseif (!preg_match($nameValidation, $data['username'])) {
42 | $data['usernameError'] = 'Name can only contain letters and numbers.';
43 | }
44 |
45 | //Validate email
46 | if (empty($data['email'])) {
47 | $data['emailError'] = 'Please enter email address.';
48 | } elseif (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
49 | $data['emailError'] = 'Please enter the correct format.';
50 | } else {
51 | //Check if email exists.
52 | if ($this->userModel->findUserByEmail($data['email'])) {
53 | $data['emailError'] = 'Email is already taken.';
54 | }
55 | }
56 |
57 | // Validate password on length, numeric values,
58 | if(empty($data['password'])){
59 | $data['passwordError'] = 'Please enter password.';
60 | } elseif(strlen($data['password']) < 6){
61 | $data['passwordError'] = 'Password must be at least 8 characters';
62 | } elseif (preg_match($passwordValidation, $data['password'])) {
63 | $data['passwordError'] = 'Password must be have at least one numeric value.';
64 | }
65 |
66 | //Validate confirm password
67 | if (empty($data['confirmPassword'])) {
68 | $data['confirmPasswordError'] = 'Please enter password.';
69 | } else {
70 | if ($data['password'] != $data['confirmPassword']) {
71 | $data['confirmPasswordError'] = 'Passwords do not match, please try again.';
72 | }
73 | }
74 |
75 | // Make sure that errors are empty
76 | if (empty($data['usernameError']) && empty($data['emailError']) && empty($data['passwordError']) && empty($data['confirmPasswordError'])) {
77 |
78 | // Hash password
79 | $data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
80 |
81 | //Register user from model function
82 | if ($this->userModel->register($data)) {
83 | //Redirect to the login page
84 | header('location: ' . URLROOT . '/users/login');
85 | } else {
86 | die('Something went wrong.');
87 | }
88 | }
89 | }
90 | $this->view('users/register', $data);
91 | }
92 |
93 | public function login() {
94 | $data = [
95 | 'title' => 'Login page',
96 | 'username' => '',
97 | 'password' => '',
98 | 'usernameError' => '',
99 | 'passwordError' => ''
100 | ];
101 |
102 | //Check for post
103 | if($_SERVER['REQUEST_METHOD'] == 'POST') {
104 | //Sanitize post data
105 | $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
106 |
107 | $data = [
108 | 'username' => trim($_POST['username']),
109 | 'password' => trim($_POST['password']),
110 | 'usernameError' => '',
111 | 'passwordError' => '',
112 | ];
113 | //Validate username
114 | if (empty($data['username'])) {
115 | $data['usernameError'] = 'Please enter a username.';
116 | }
117 |
118 | //Validate password
119 | if (empty($data['password'])) {
120 | $data['passwordError'] = 'Please enter a password.';
121 | }
122 |
123 | //Check if all errors are empty
124 | if (empty($data['usernameError']) && empty($data['passwordError'])) {
125 | $loggedInUser = $this->userModel->login($data['username'], $data['password']);
126 |
127 | if ($loggedInUser) {
128 | $this->createUserSession($loggedInUser);
129 | } else {
130 | $data['passwordError'] = 'Password or username is incorrect. Please try again.';
131 |
132 | $this->view('users/login', $data);
133 | }
134 | }
135 |
136 | } else {
137 | $data = [
138 | 'username' => '',
139 | 'password' => '',
140 | 'usernameError' => '',
141 | 'passwordError' => ''
142 | ];
143 | }
144 | $this->view('users/login', $data);
145 | }
146 |
147 | public function createUserSession($user) {
148 | $_SESSION['user_id'] = $user->id;
149 | $_SESSION['username'] = $user->username;
150 | $_SESSION['email'] = $user->email;
151 | header('location:' . URLROOT . '/pages/index');
152 | }
153 |
154 | public function logout() {
155 | unset($_SESSION['user_id']);
156 | unset($_SESSION['username']);
157 | unset($_SESSION['email']);
158 | header('location:' . URLROOT . '/users/login');
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/app/helpers/session_helper.php:
--------------------------------------------------------------------------------
1 | getUrl());
14 |
15 | $url = $this->getUrl();
16 |
17 | // Look in BLL for first value
18 | if(file_exists('../app/controllers/' . ucwords($url[0]). '.php')){
19 | // If exists, set as controller
20 | $this->currentController = ucwords($url[0]);
21 | // Unset 0 Index
22 | unset($url[0]);
23 | }
24 |
25 | // Require the controller
26 | require_once '../app/controllers/'. $this->currentController . '.php';
27 |
28 | // Instantiate controller class
29 | $this->currentController = new $this->currentController;
30 |
31 | // Check for second part of url
32 | if(isset($url[1])){
33 | // Check to see if method exists in controller
34 | if(method_exists($this->currentController, $url[1])){
35 | $this->currentMethod = $url[1];
36 | // Unset 1 index
37 | unset($url[1]);
38 | }
39 | }
40 |
41 | // Get params
42 | $this->params = $url ? array_values($url) : [];
43 |
44 | // Call a callback with array of params
45 | call_user_func_array([$this->currentController, $this->currentMethod], $this->params);
46 | }
47 |
48 | public function getUrl(){
49 | if(isset($_GET['url'])){
50 | $url = rtrim($_GET['url'], '/');
51 | $url = filter_var($url, FILTER_SANITIZE_URL);
52 | $url = explode('/', $url);
53 | return $url;
54 | }
55 | }
56 | }
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/libraries/Database.php:
--------------------------------------------------------------------------------
1 | dbHost . ';dbname=' . $this->dbName;
14 | $options = array(
15 | PDO::ATTR_PERSISTENT => true,
16 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
17 | );
18 | try {
19 | $this->dbHandler = new PDO($conn, $this->dbUser, $this->dbPass, $options);
20 | } catch (PDOException $e) {
21 | $this->error = $e->getMessage();
22 | echo $this->error;
23 | }
24 | }
25 |
26 | //Allows us to write queries
27 | public function query($sql) {
28 | $this->statement = $this->dbHandler->prepare($sql);
29 | }
30 |
31 | //Bind values
32 | public function bind($parameter, $value, $type = null) {
33 | switch (is_null($type)) {
34 | case is_int($value):
35 | $type = PDO::PARAM_INT;
36 | break;
37 | case is_bool($value):
38 | $type = PDO::PARAM_BOOL;
39 | break;
40 | case is_null($value):
41 | $type = PDO::PARAM_NULL;
42 | break;
43 | default:
44 | $type = PDO::PARAM_STR;
45 | }
46 | $this->statement->bindValue($parameter, $value, $type);
47 | }
48 |
49 | //Execute the prepared statement
50 | public function execute() {
51 | return $this->statement->execute();
52 | }
53 |
54 | //Return an array
55 | public function resultSet() {
56 | $this->execute();
57 | return $this->statement->fetchAll(PDO::FETCH_OBJ);
58 | }
59 |
60 | //Return a specific row as an object
61 | public function single() {
62 | $this->execute();
63 | return $this->statement->fetch(PDO::FETCH_OBJ);
64 | }
65 |
66 | //Get's the row count
67 | public function rowCount() {
68 | return $this->statement->rowCount();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/app/models/Post.php:
--------------------------------------------------------------------------------
1 | db = new Database;
7 | }
8 |
9 | public function findAllPosts() {
10 | $this->db->query('SELECT * FROM posts ORDER BY created_at ASC');
11 |
12 | $results = $this->db->resultSet();
13 |
14 | return $results;
15 | }
16 |
17 | public function addPost($data) {
18 | $this->db->query('INSERT INTO posts (user_id, title, body) VALUES (:user_id, :title, :body)');
19 |
20 | $this->db->bind(':user_id', $data['user_id']);
21 | $this->db->bind(':title', $data['title']);
22 | $this->db->bind(':body', $data['body']);
23 |
24 | if ($this->db->execute()) {
25 | return true;
26 | } else {
27 | return false;
28 | }
29 | }
30 |
31 | public function findPostById($id) {
32 | $this->db->query('SELECT * FROM posts WHERE id = :id');
33 |
34 | $this->db->bind(':id', $id);
35 |
36 | $row = $this->db->single();
37 |
38 | return $row;
39 | }
40 |
41 | public function updatePost($data) {
42 | $this->db->query('UPDATE posts SET title = :title, body = :body WHERE id = :id');
43 |
44 | $this->db->bind(':id', $data['id']);
45 | $this->db->bind(':title', $data['title']);
46 | $this->db->bind(':body', $data['body']);
47 |
48 | if ($this->db->execute()) {
49 | return true;
50 | } else {
51 | return false;
52 | }
53 | }
54 |
55 | public function deletePost($id) {
56 | $this->db->query('DELETE FROM posts WHERE id = :id');
57 |
58 | $this->db->bind(':id', $id);
59 |
60 | if ($this->db->execute()) {
61 | return true;
62 | } else {
63 | return false;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/models/User.php:
--------------------------------------------------------------------------------
1 | db = new Database;
6 | }
7 |
8 | public function register($data) {
9 | $this->db->query('INSERT INTO users (username, email, password) VALUES(:username, :email, :password)');
10 |
11 | //Bind values
12 | $this->db->bind(':username', $data['username']);
13 | $this->db->bind(':email', $data['email']);
14 | $this->db->bind(':password', $data['password']);
15 |
16 | //Execute function
17 | if ($this->db->execute()) {
18 | return true;
19 | } else {
20 | return false;
21 | }
22 | }
23 |
24 | public function login($username, $password) {
25 | $this->db->query('SELECT * FROM users WHERE username = :username');
26 |
27 | //Bind value
28 | $this->db->bind(':username', $username);
29 |
30 | $row = $this->db->single();
31 |
32 | $hashedPassword = $row->password;
33 |
34 | if (password_verify($password, $hashedPassword)) {
35 | return $row;
36 | } else {
37 | return false;
38 | }
39 | }
40 |
41 | //Find user by email. Email is passed in by the Controller.
42 | public function findUserByEmail($email) {
43 | //Prepared statement
44 | $this->db->query('SELECT * FROM users WHERE email = :email');
45 |
46 | //Email param will be binded with the email variable
47 | $this->db->bind(':email', $email);
48 |
49 | //Check if email is already registered
50 | if($this->db->rowCount() > 0) {
51 | return true;
52 | } else {
53 | return false;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/require.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/views/includes/navigation.php:
--------------------------------------------------------------------------------
1 |
27 |
--------------------------------------------------------------------------------
/app/views/index.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
8 |
9 |
10 |
One man's crappy software
11 | is another man's full-time job.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/views/posts/create.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 | Create new post
14 |
15 |
16 |
35 |
36 |
--------------------------------------------------------------------------------
/app/views/posts/index.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 | Create
15 |
16 |
17 |
18 |
19 |
20 | user_id): ?>
21 |
id ?>">
24 | Update
25 |
26 |
29 |
30 |
31 | title; ?>
32 |
33 |
34 |
35 | created_at)) ?>
36 |
37 |
38 |
39 | body ?>
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/views/posts/update.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 | Update post
14 |
15 |
16 |
39 |
40 |
--------------------------------------------------------------------------------
/app/views/users/login.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
10 |
11 |
32 |
--------------------------------------------------------------------------------
/app/views/users/register.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
10 |
11 |
46 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Options -Multiviews
3 | RewriteEngine On
4 | RewriteBase /mvcblog/public
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteCond %{REQUEST_FILENAME} !-f
7 | RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
8 |
9 |
--------------------------------------------------------------------------------
/public/css/style.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | width: 100%;
4 | padding: 0;
5 | margin: 0;
6 | top: 0;
7 | bottom: 0;
8 | font-family: 'Lato', sans-serif;
9 | background-color: #f2f2f2;
10 | }
11 |
12 | a {
13 | text-decoration: none;
14 | }
15 |
16 | h2 {
17 | font-size: 50px;
18 | margin: 0;
19 | }
20 |
21 | h3 {
22 | font-size: 14px;
23 | color: #696969;
24 | font-weight: 100;
25 | font-style: italic;
26 | }
27 |
28 | p {
29 | font-size: 18px;
30 | color: #666;
31 | }
32 |
33 | .top-nav {
34 | display: block;
35 | }
36 |
37 | .top-nav ul {
38 | margin: 0;
39 | padding: 0;
40 | position: absolute;
41 | right: 6%;
42 | top: 2%;
43 | }
44 |
45 | .top-nav ul li {
46 | display: inline-block;
47 | margin-left: 28px;
48 | }
49 |
50 | .top-nav ul li a {
51 | color: #ffffff;
52 | text-decoration: none;
53 | font-size: 18px;
54 | }
55 |
56 | .top-nav ul li a:hover {
57 | color: #afafaf;
58 | transition: 0.15s ease-in;
59 | }
60 |
61 | #section-landing {
62 | background: url('../img/banner.jpg');
63 | background-size: cover;
64 | background-position: center;
65 | background-repeat: no-repeat;
66 | height: 100%;
67 | width: 100%;
68 | }
69 |
70 | .wrapper-landing {
71 | position: relative;
72 | text-align: center;
73 | margin: 0 auto;
74 | width: 100%;
75 | top: 40%;
76 | }
77 |
78 | .wrapper-landing h1 {
79 | font-size: 48px;
80 | color: #ffffff;
81 | margin: 0;
82 | font-weight: 100;
83 | }
84 |
85 | .wrapper-landing h2 {
86 | font-size: 42px;
87 | color: #f2f2f2;
88 | opacity: 0.6;
89 | margin: 0;
90 | font-weight: 100;
91 | }
92 |
93 | .btn-login {
94 | border: 1px solid #ffffff;
95 | padding: 6px 24px;
96 | }
97 |
98 | .navbar {
99 | width: 100%;
100 | height: 70px;
101 | background-color: #1a1a1a;
102 | box-shadow: 0px 0px 10px #1a1a1a;
103 | }
104 |
105 | .container-login {
106 | width: 100%;
107 | margin: 0 auto;
108 | position: relative;
109 | top: 20%;
110 | }
111 |
112 | .wrapper-login {
113 | width: 80%;
114 | margin: 0 auto;
115 | text-align: center;
116 | }
117 |
118 | .wrapper-login input {
119 | width: 200px;
120 | height: 26px;
121 | border: 1px solid #cccccc;
122 | background-color: #f5f5f5;
123 | font-size: 18px;
124 | display: block;
125 | position: relative;
126 | margin: 20px auto;
127 | }
128 |
129 | input::placeholder {
130 | color: #a1a1a1;
131 | font-size: 14px;
132 | }
133 |
134 | .wrapper-login h2 {
135 | font-size: 40px;
136 | text-transform: uppercase;
137 | }
138 |
139 | #submit {
140 | width: 200px;
141 | height: 42px;
142 | border: 1px solid #000000;
143 | background-color: #000000;
144 | color: #ffffff;
145 | font-size: 20px;
146 | margin: 20px 0px 0px 0px;
147 | }
148 |
149 | #submit:hover {
150 | border: 1px solid #a1a1a1;
151 | background-color: #a1a1a1;
152 | transition: 0.15s ease-in;
153 | }
154 |
155 | .options a {
156 | color: #006400;
157 | }
158 |
159 | .options a:hover {
160 | color: #000000;
161 | transition: 0.20s ease-in;
162 | text-decoration: none;
163 | }
164 |
165 | .invalidFeedback {
166 | color: #ff0000;
167 | display: block;
168 | }
169 |
170 | /* BLOG */
171 | .dark {
172 | background-color: #000000;
173 | box-shadow: 0px 0px 10px #000000;
174 | }
175 |
176 | .container {
177 | margin: 0 auto;
178 | width: 80%;
179 | padding: 100px 0px;
180 | }
181 |
182 | .container-item {
183 | border-bottom: 1px solid #dcdcdc;
184 | padding: 40px 0px;
185 | }
186 |
187 | .btn {
188 | padding: 8px 18px;
189 | font-size: 20px;
190 | text-transform: uppercase;
191 | color: #ffffff;
192 | }
193 |
194 | .btn:hover {
195 | color: #ffffff;
196 | }
197 |
198 | .green {
199 | background-color: #4CAF50;
200 | }
201 |
202 | .green:hover {
203 | background-color: #64A764;
204 | transition: 0.20s ease-in-out;
205 | }
206 |
207 | /* Create Post */
208 | .center {
209 | text-align: center;
210 | }
211 |
212 | input, textarea {
213 | width: 400px;
214 | margin: 20px 0px;
215 | border: 1px solid #cbcbcb;
216 | border-radius: 4px;
217 | background-color: #f5f5f5;
218 | padding: 8px;
219 | font-size: 18px;
220 | color: #666;
221 | }
222 |
223 | input {
224 | height: 35px;
225 | }
226 |
227 | textarea {
228 | height: 200px;
229 | }
230 |
231 | ::placeholder {
232 | font-size: 14px;
233 | font-weight: 100;
234 | font-style: italic;
235 | }
236 |
237 | .orange {
238 | background-color: orange;
239 | color: #000000;
240 | float: right;
241 | }
242 |
243 | .red {
244 | background-color: #ff0000;
245 | float: right;
246 | width: 120px;
247 | margin: 0px 20px;
248 | height: 40px;
249 | }
250 |
--------------------------------------------------------------------------------
/public/img/banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codewithdary/mvc-blog/2e4746f8877ce0a6d6c9d50c4822a1bf42300a9e/public/img/banner.jpg
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |