Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 2.56 KB

README.md

File metadata and controls

76 lines (63 loc) · 2.56 KB

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