Giter Club home page Giter Club logo

php-clean-blog's Introduction

php-clean-blog

Clean Blog from Start Bootstrap implemented with PHP.

Quickstart

Clone the repo

$ git clone [email protected]:cfc603/php-clean-blog.git
$ cd php-clean-blog/

Set DB_USER and DB_PASS to your MySQL username and password

$ nano private/db_credentials.php

Create MySQL database and test data

$ mysql -u <username> -p < database/create.sql
Enter password: <password>

Run local server

$ cd public/
$ php -S localhost:8000

Not Production Ready

There are several issues which should be addressed before deploying to a production environment.

  1. Need Create, Update & Delete Views
  2. Needs authentication
  3. Escape Blog Post body

php-clean-blog's People

Contributors

cfc603 avatar

Watchers

James Cloos avatar  avatar

php-clean-blog's Issues

Escape Blog Post body

Currently all data from the database is escaped using PHPs htmlspecialchars function with the exception to Post.body in the following view:

// public/posts/view.php

...
<!-- Post Content -->
<article>
  <div class="container">
    <div class="row">
      <div class="col-lg-8 col-md-10 mx-auto">
        <?php echo $post["body"]; ?>
      </div>
    </div>
  </div>
</article>
...

As formatting in the post body is using html characters, we need another solution for formatting or preventing XSS attacks.

Need Create, Update & Delete Views

public/posts offers a way to view posts but no views for creating, updating or deleting posts. Query functions have been created in private/query_functions.php :

// Create Post
create_post($record) # takes associate array as argument

// Update Post
update_post($record) # takes associate array as argument

// Delete Post
delete_post($id)

Needs authentication

As there are not view for creating, updating or deleting posts an authentication system was not necessary but should be added with these views #1

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.