Overview: This technical manual provides the necessary information for setting up and managing the Incidents Management System (IMS) using Docker, which encapsulates the components of the LAMP stack.
User Manual: UserManualforIMS
URL for Start Page:
http://localhost/cw2/index.php
File Structure:
-
cw2/
: Main application directory.css/
: Style sheets includingstyle.css
.inc/
: PHP includes and utility scripts.js/
: JavaScript files includingscript.js
.sql/
: Database scripts includingcw2.sql
.index.php
: Landing page for the IMS.- other PHP files: Core application scripts.
-
car.ico
: Favicon for the web application. -
Docker Configuration:
-
docker-compose.yml
: Docker configuration for setting up the environment.
Docker Configuration:
php-apache/
: Custom PHP and Apache server configuration.mariadb/
: MariaDB server configuration and initial SQL files.mariadb-data/
: Persistent storage for MariaDB.phpmyadmin/
: PHPMyAdmin interface for database management.
Software Dependencies:
- Docker and Docker Compose
- PHP 8.0, MariaDB 10, and Apache web server
Installation Steps:
- Install Docker from Docker Official Website.
- Navigate to the project directory.
- Execute
docker compose up
to build and start the services. - Once the containers are running, access IMS at
http://localhost/cw2/index.php
and PHPMyAdmin athttp://localhost:8081
.
Initial Configuration:
- The
config.php
file should match the Docker MariaDB configuration for database connectivity.
Code Organization:
- Directory Structure: The
html/
directory hosts all web resources including HTML, PHP, CSS, and JavaScript files. - PHP Includes:
inc/
directory contains shared PHP scripts like headers and footers. - Functions: A library of functions (
functions.php
) provides common operations such as database access and user authentication. - Database Interaction:
sql/
directory stores the initial database schema and scripts for the IMS.
Database Design:
- Schema: The
cw2.sql
file contains the database schema for the TIS. - Data Persistence: The
mariadb-data/
directory serves as the persistent storage for the MariaDB container. - Queries: Key SQL queries for operations such as user login, record retrieval, and report generation.
- Login:
SELECT * FROM Police WHERE Police_username = $username AND Police_password = $password
- QueryVehicle:
SELECT Vehicle.*, People.* FROM Vehicle LEFT JOIN Ownership ON Vehicle.Vehicle_ID = Ownership.Vehicle_ID LEFT JOIN People ON Ownership.People_ID = People.People_ID WHERE Vehicle.Vehicle_licence LIKE $info
- AddReport:
INSERT INTO Incident (Vehicle_ID, People_ID, Incident_Date, Incident_Report, Offence_ID) VALUES ($vehicleID, $peopleID, $incidentDate, $incidentReport, $offenceID)
- Login:
AJAX and JavaScript:
- Asynchronous data interactions are handled using native JavaScript without third-party libraries.
Security Practices:
- Use of prepared statements for database interaction to mitigate SQL injection risks.
Development Practices:
- Adherence to established PHP and web development standards.
System Extensibility:
- The modular design allows for the addition of new features with minimal impact on existing functionalities.
Rebuilding the Database:
- To reset and rebuild the database from the SQL source in
mariadb/
, clear themariadb-data/
directory and rundocker compose up
.
Frameworks:
- Bootstrap: Provides the responsive UI components.
Assets:
car.ico
: Icon used across the system for visual identification.
Styles:
mvp.css
: Minimal stylesheet for attractive defaults.
External Code:
- Example code from the module and various utility functions and UI patterns adapted from online resources.