Git Product home page Git Product logo

mvc-blog-1's Introduction

MVC Personal Blog

Prologue

MVC (Model - View - Controller) is a software architectural pattern for implementing user interfaces on computers. As someone gets deep in web (or software) development, he/she should understand the principles that come from MVC.

This project uses the above idea. With that in mind, I created a simple blog style personal website, mainly for study purposes and better understanding of modern web development.

Technical details

Requirements:

  1. PHP version 5.5 and above.

Third party modules:

  1. PHPMailer ( used in contact form )

Project Set Up

To test the project in your machine you have to change the following options in files:

  • email.php ( under models )

Set

 $mail->Username = "[email protected]";
 $mail->Password = "your_application_password";
 $mail->addAddress("[email protected]");

To get a Gmail application password follow the official guide.


  • dependences.php ( under config )

In this file the only you want to change is the $_Title variable that holds the title of each page.

Admin & Members accounts

The project uses many-accounts relationship. This means that there is only one admin account which can edit-delete all the other members posts as well to write his/her own. All the other accounts are personal and can manipulate only their posts.

Members

To register an account (as there is no such thing as register form) you have to contact to admin by contact page and request one member account.

Admin

The administrator of the website needs to change a line so the server can recognize him.

  • admin.variables.com ( under members/config )

Change $adminEmail variable with your own domain.

For better security use a custom domain.

Example: [email protected]

Blog writers and domains

The domain of each user is shown in the footer area of each post in this format:

Added on Day Month Year from member's email

For administator posts the member's email section is filled with the following account :

some_name @epost.com

Database

You have to change the following files to be able to connect to Mysql database.

  • db.php ( under config )

Set the following options with your credentials:

define('DBHOST','host');
define('DBUSER','user');
define('DBPASS','password');
define('DBNAME','name');

The database uses two tables. One is called blog_members and the other blog_post.

Blog Members

The members table holds the admin account as well as all the other users. To set a new account you have to type manually an SQL Insert comand like so:

INSERT INTO `blog_members`(`username`, `password`, `email`) VALUES ('someUserName','somePassword','comeEmail')

If you are new to Mysql, please install phpMyAdmin for better command support.

For Member Database Schema see: members/members_schema.sql

Blog Posts

The post table holds the title, a description and the main content of each post as well as the date of creation.

For Posts Database Schema see: blog/posts_schema.sql

Safety

We add a helper php script called bcrypt.php under root directory. This script takes as input a text value and returned the hashed one. The feature adds some security to our members as we verify now their passwords using bcrypt.

As we use password_verify() to verify their passwords from database, you must store the hashed password and not use plain text one.

mvc-blog-1's People

Contributors

georgegkas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.