Skip to content

aaron0745/SQL_Project_2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛒 SQL-Powered Inventory Management System (IMS)

📄 Overview

This project is a minimal but fully functional web-based Inventory Management System (IMS) built using PHP, MySQL, and basic CSS/JavaScript.

It is designed to demonstrate fundamental web development concepts, including user authentication, **session management, **database transaction handling, and **role-based access control (RBAC).

The system supports three primary user roles: Admin, Staff, and Supplier.

✨ Features

  • Role-Based Access Control (RBAC): Restricts page access based on user role (admin, staff, supplier).
  • Secure Authentication: Uses password_verify() for secure login and session management.
  • Product Management: Admin/Staff users can add, view, edit, and delete products.
  • Real-time Stock Tracking: Sales automatically decrement product stock.
  • Low Stock Alerts: Identifies products falling below a set threshold.
  • Sales Module: Dedicated transaction page for staff to quickly record sales.
  • Dashboard: Provides key metrics, including daily revenue and low stock counts.

📂 Project Structure

The project follows a modular and organized structure:

SQL_Project_2.0/
├── assets
│   ├── css
│   │   └── styles.css
│   └── js
│       └── scripts.js
├── ims_database.sql
├── includes
│   ├── db_connect.php
│   ├── footer.php
│   ├── functions.php
│   └── header.php
├── index.php
├── login.php
├── logout.php
├── pages
│   ├── admin
│   │   ├── admin_dashboard.php
│   │   ├── manage_users.php
│   │   └── user_form.php
│   ├── inventory
│   │   ├── low_stock.php
│   │   ├── product_form.php
│   │   └── products.php
│   └── sales
│       ├── sales_history.php
│       └── sales.php
└── README.md

⚙️ Setup and Installation

Follow these steps to deploy and run the application locally:

1. Requirements

  • Web Server (Apache, Nginx)
  • PHP (7.4 or higher)
  • MySQL/MariaDB

2. Database Setup

  1. Access your MySQL/MariaDB terminal (e.g., mysql -u root -p).

  2. Execute the provided SQL script to create the database (inventory_db_2) and populate it with tables and default users: bash source /path/to/your/project/ims_database.sql

  3. Create Database User: Ensure the webuser and webpass credentials match those defined in includes/db_connect.php: sql CREATE USER 'webuser'@'localhost' IDENTIFIED BY 'webpass'; GRANT ALL PRIVILEGES ON inventory_db_2.* TO 'webuser'@'localhost'; FLUSH PRIVILEGES;

3. Application Deployment

  1. Copy the entire project folder to your web server's root directory. If you are using a subdirectory (e.g., /var/www/html/SQL_Project_2.0), make sure the BASE_PATH in includes/functions.php is correctly set:

    php // includes/functions.php define('BASE_PATH', '/SQL_Project_2.0/'); // Must match your deployment folder

  2. Ensure the web server has read/write permissions for the project directory:

    bash

    Assuming the project folder is SQL_Project_2.0

    sudo chown -R www-data:www-data /var/www/html/SQL_Project_2.0 sudo chmod -R 755 /var/www/html/SQL_Project_2.0

4. Access the Application

Open your browser and navigate to:

http://localhost/SQL_Project_2.0/

🔑 Default Credentials

The ims_database.sql file includes the following default users:

Username Password Role Access
admin1 password Admin Full access to users, products, and sales.
staff1 password Staff Access to products, sales, and low stock reports.
supplier1 password Supplier Access limited to their assigned orders/low stock alerts.

(Note: The default password 'password' is hashed using bcrypt for security in the database.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •