Knowledge-Based Article Management SystemA PHP knowledge base management system on MySQL

A case study in building a content platform on PHP and MySQL: categorised articles, a three-state lifecycle, Admin and Customer roles, AJAX search, and defences against SQL injection and XSS.

Category
Full Stack
Industry
Knowledge management
Platform
Web application
Status
Private project
  • 3article states: Active, Archived, Deleted
  • 2roles: Admin and Customer
  • AJAXsearch without page reloads
  • SQLi + XSSdefended on every form
Knowledge-Based Article Management System
Knowledge Base page with category cards for Security, Troubleshooting and User Feedback, each with a View all articles button, above a Knowledge Base footer panel
Overview

The PHP knowledge base management system at a glance

The Knowledge-Based Article Management System is a PHP knowledge base I built for organisations that publish and maintain help articles, such as businesses, educators and knowledge-sharing communities.

Admins write, categorise, archive and remove articles, while customers find and read them. It runs on PHP and MySQL, with Bootstrap and AJAX on the front end and protection against SQL injection and XSS.

Readers come in through categories such as Security, Troubleshooting and User Feedback, or search by keyword. Behind that, every article sits in one of three states, Active, Archived or Deleted, and only Active articles reach a reader.

Role
Full-stack developer
Industry
Knowledge management
Audience
Businesses, educators and knowledge-sharing communities
Platform
Web application
Type
Content management web application
Category
Full Stack
Stack
PHP, MySQL, HTML5, CSS3
Status
Private project
The challenge

Why help content needs a knowledge base management system

Help content tends to collect in the wrong places: old emails, a shared drive of near-identical documents, or the memory of whoever has been around longest.

When someone needs an answer they ask a colleague, and the same question gets answered over and over.

A knowledge base only fixes that while it stays maintained. Articles go out of date; deleting them outright throws away history that might still matter, and leaving them up misleads readers. The people writing the content also need a different view of the system from the people reading it. Most of the design effort therefore went into managing an article across its whole life, with publishing as one stage of it.

How things worked before Knowledge-Based Article Management System, compared with Knowledge-Based Article Management System
Before Knowledge-Based Article Management SystemWith Knowledge-Based Article Management System
Answers buried in old emails and shared drivesArticles grouped into categories, each with its own listing
The same question answered over and overSearch by keyword, category or status
Outdated articles deleted, or left up to misleadAn Active, Archived and Deleted lifecycle
One view for writers and readers alikeSeparate Admin and Customer dashboards

The brief I set myself

  • Whole lifecycleTreat publishing as one stage of an article's life.
  • Nothing lostRetire articles without destroying them.
  • Two viewsWriters and readers each get their own dashboard.
  • Safe by defaultEvery input bound, every output escaped.
My role

My role: building the PHP knowledge base end to end

I built the application end to end, from the MySQL schema and the PHP logic to the admin and customer dashboards and the Bootstrap interface.

That covered the PHP logic for articles, categories, users and search, and an interface built with Bootstrap and JavaScript. Working in PHP without a framework meant writing the pieces a framework usually hands you, such as session checks, input validation and output escaping, and knowing exactly which attack each one closes off.

Scope of work on Knowledge-Based Article Management System
DatabaseThe MySQL schema linking articles, categories and users, with indexes on the category and status columns.
Back endPHP logic for articles, categories, users and search, plus small endpoints called over AJAX.
AccessAdmin and Customer roles held in the server-side session and checked at the top of every admin page.
SecurityPrepared statements, output escaping with htmlspecialchars, hashed passwords and a fresh session id at login.
InterfaceThe admin and customer dashboards, built with Bootstrap, HTML5, CSS3 and JavaScript.
How it works

How an article moves through the PHP knowledge base

An article has a life beyond publishing: an admin writes and files it, readers find it, and when it goes out of date it is archived instead of destroyed.

  1. Step 1

    Write and categorise

    An admin writes the article and files it under a category, where it appears in that category's listing.

    Categories
    SecurityTroubleshootingUser Feedback
  2. Step 2

    Readers find it

    Customers browse by category or search by keyword, with results updated over AJAX. Customer-facing queries only return Active articles.

    Find by
    CategoryKeyword search
  3. Step 3

    Archive it when it goes stale

    An admin archives an outdated article without losing their place in a long list. It drops out of the customer view at once but stays available to admins.

    Admin filters
    KeywordCategoryStatus
  4. Step 4

    Delete, with a way back

    Deleted works as a holding state that can still be reviewed, so a removed article is not gone until an admin decides it should be.

    States
    ActiveArchivedDeleted
Key features

Knowledge base features: categories, lifecycle and search

The features split along the two roles: admins get the tools to write, organise and retire articles, and customers get a fast way to find them.

Category-first structure

Articles are grouped into categories such as Security, Troubleshooting and User Feedback, each with its own article listing.

A full article lifecycle

Every article is Active, Archived or Deleted, and admins move it between those states.

Admin and Customer roles

Each role has its own dashboard and its own permissions, checked on every page.

Search and filters over AJAX

Find articles by keyword, category or status, with results updated without a page reload.

In-place admin actions

Changing an article's status happens over AJAX, so an admin keeps their place in a long list.

Security throughout

Protection against SQL injection, XSS and unauthorised access on every form and page.

Hashed passwords and safe sessions

Passwords are stored as hashes, and the session id is regenerated at login.

Responsive Bootstrap interface

Articles and dashboards read well on any screen size.

Architecture

How the PHP knowledge base is built: architecture and stack

Four decisions shaped the build: relational tables for the content, prepared statements for input, escaping on output, and AJAX wherever a full reload would get in the way.

Data

Relational tables for articles, categories and users

The data is relational by nature: every article belongs to a category, has an author and sits in exactly one lifecycle state. MySQL with keys linking those tables keeps the relationships consistent, and turns a category page or a status filter into a single indexed query instead of a pass over every article.

Security

Prepared statements for every query that takes input

Search boxes and filters are the usual route in for SQL injection, because user input ends up inside a WHERE clause. Every query that accepts input uses a prepared statement with bound parameters, so a search term is always treated as a value and never as SQL, whatever characters it contains.

Output

Escaping on output against XSS

Articles are content written by one user and shown to others, which is exactly the shape of a stored XSS attack. Titles, search terms and other text fields are escaped with htmlspecialchars at the moment they are rendered, so markup typed into any of them appears as plain text instead of running in a reader's browser.

Interaction

AJAX for search and admin actions

In a classic PHP app, running a search, applying a filter or changing an article's status would each reload the whole page. Small PHP endpoints called over AJAX return only the data that changed, so results update in place and an admin can archive an article without losing their position in a long list.

The Knowledge-Based Article Management System tech stack

Technologies used in Knowledge-Based Article Management System and what each one does
TechnologyWhat it does in Knowledge-Based Article Management System
PHPServer logic for articles, categories, users, sessions and search, written without a framework.
MySQLRelational storage for articles, categories and users, queried through prepared statements.
HTML5The markup for the dashboards and article pages.
CSS3Styling on top of Bootstrap.
JavaScriptClient-side behaviour, including the requests behind search and status changes.
AJAXSearch results and admin actions updated in place, without a page reload.
BootstrapThe responsive grid and components for both dashboards.
Challenges

Challenges in building a PHP knowledge base, and how I solved them

Three problems shaped most of the code: retiring articles without losing them, keeping customers out of admin pages, and fast, safe search on plain MySQL.

Retiring an article without losing it

Problem

A hard delete is final, and in a knowledge base the article removed today is sometimes the one a customer still has bookmarked tomorrow. Keeping everything visible is no better, because outdated instructions do more harm than no instructions.

Solution

Articles carry a status instead of being removed from the table. Archived articles drop out of the customer view but stay available to admins, and Deleted works as a holding state that can still be reviewed. Customer-facing queries only return Active articles, so an article disappears for readers the moment it is archived.

Keeping customers out of admin pages

Problem

In a PHP app each page is its own entry point. Forget the permission check on one admin page and a customer who guesses the URL can open it; hiding the link in the menu protects nothing.

Solution

Every admin page begins with the same check against the role held in the server-side session and redirects anyone without the Admin role before any data is loaded. Passwords are stored as hashes, and the session id is regenerated at login so an old session cannot be reused.

Fast search on plain MySQL

Problem

Readers expect search to respond straight away, but the project runs on MySQL alone, and a query with several optional filters is easy to write badly or unsafely.

Solution

The search endpoint builds its WHERE clause only from the filters actually set, binds each as a parameter, and returns results over AJAX so only the list redraws. Indexes on the category and status columns keep filtered queries cheap.

Results

Results: one place to write, organise and retire help articles

The finished system gives admins one place to write, organise and retire articles, and gives readers a category-first way in.

The screenshot shows that way in as cards for Security, Troubleshooting and User Feedback. Archived content stops cluttering what readers see, and nothing an admin removes is gone until they decide it should be.

Role-based access appears in several of my projects, and the same idea changes shape with the stack. Here it is two roles enforced through PHP sessions on each page; in the MERN team management system with three roles it moves into Express middleware and a signed JWT.

What's next for Knowledge-Based Article Management System

The next steps would be version history for each article, so edits can be compared and rolled back, and MySQL full-text search that ranks results by relevance. Rebuilding the reader side as a single-page app, along the lines of my Vue.js job board, would also make moving between categories faster.

FAQ

PHP knowledge base management system: frequently asked questions

Short answers to the questions people ask most about this knowledge base, its article lifecycle and how it stays secure on plain PHP.

What is a knowledge base management system?

A system for writing, organising and maintaining help articles so people can find answers themselves. This one is built in PHP and MySQL, groups articles into categories, and manages each article across an Active, Archived and Deleted lifecycle.

What is the Knowledge-Based Article Management System built with?

PHP and MySQL on the server, with HTML5, CSS3, JavaScript, AJAX and Bootstrap on the front end. There is no PHP framework underneath it.

How does the PHP knowledge base prevent SQL injection and XSS?

Every query that takes input uses a prepared statement with bound parameters, so input is always treated as a value. Text is escaped with htmlspecialchars when it is rendered, so markup typed into an article or search box shows as plain text.

What happens when an article is archived or deleted?

An archived article drops out of the customer view but stays available to admins. Deleted is a holding state that can still be reviewed, so nothing is gone until an admin decides it should be.

What can Admins and Customers do?

Admins write, categorise, archive and remove articles from their own dashboard. Customers find and read Active articles by category or search. Every admin page checks the role before loading any data.

Who built the PHP knowledge base management system?

Muhammad Abdullah Awais, a full-stack developer based in Pakistan. I built it end to end, and I am available for freelance and full-time work on products like it.

Available for new builds

Need a full-stack developer for a product like this?

I work remotely with teams in the US, Canada, the UK, Europe and the Gulf, and with clients across Pakistan. Based in Pakistan (PKT, UTC+5), available for freelance and full-time roles.