A blog post system using PHP and MYSQL
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
fonts
js
.gitignore
.htaccess
README.md
api.php
article.php
comment.php
config.php
createPost.php
delete.php
edit.php
error.log
functions.php
index.php
login.php
logout.php
response.php
session.php
signup.php
test.php
welcome.php

README.md

php-user

A blog post system using PHP and MYSQL

Features

  • Log in/out with password
  • Mobile responsive
  • Cached drafts
  • Paging
  • Comments
  • Editing for owners
  • API for articles

Rules

  • Users have to log in to post/comment
  • Topics/contents have to be long enough
  • Only owners can edit

APIs

Working on url rewrite with mod_rewrite module but failing.

  • /api.php?request=post&number=all
    Retrieve all article objects in json array
  • /api.php?request=post&number={articleId}
    Retrieve article object with id 'articleId'

Database Structures

  1. Auth:
+--------------+-------------+------+-----+---------+----------------+
| Field        | Type        | Null | Key | Default | Extra          |
+--------------+-------------+------+-----+---------+----------------+
| id           | int(11)     | NO   | PRI | NULL    | auto_increment |
| username     | varchar(20) | YES  |     | NULL    |                |
| passwordhash | varchar(50) | YES  |     | NULL    |                |
+--------------+-------------+------+-----+---------+----------------+
  1. Post:
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int(11)      | NO   | PRI | NULL    | auto_increment |
| topic     | varchar(255) | YES  |     | NULL    |                |
| content   | longtext     | YES  |     | NULL    |                |
| author    | tinytext     | YES  |     | NULL    |                |
| post_time | tinytext     | YES  |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+
  1. Comment:
+-----------+----------+------+-----+---------+----------------+
| Field     | Type     | Null | Key | Default | Extra          |
+-----------+----------+------+-----+---------+----------------+
| id        | int(11)  | NO   | PRI | NULL    | auto_increment |
| articleId | int(11)  | NO   |     | NULL    |                |
| author    | tinytext | YES  |     | NULL    |                |
| content   | longtext | YES  |     | NULL    |                |
| post_time | tinytext | YES  |     | NULL    |                |
+-----------+----------+------+-----+---------+----------------+

Next Steps

  • Delete posts for owners
  • Make log in/out prettier
  • Make pagination prettier
  • Add some JS animations
  • Move log in/out to main page
  • Different authorization levels for users
  • APIs for articles, comments and users