Online Shopping Portal

Project by: Praphul Kant • M.Sc. Computer Science • Submitted to: Magadh University, Bodhgaya

Introduction

In the rapidly evolving digital age, the way consumers interact with businesses and purchase products has undergone a dramatic transformation. The advent of the internet and ICT have given rise to e-commerce. This project — "Online Shopping Website Using PHP and MySQL" — develops a fully functional, dynamic, and secure web application replicating core features of a commercial e-commerce platform.

Users can browse products, register accounts, log in, add products to a shopping cart, and place orders. A robust back-end database manages user credentials, product listings, cart information, and order history.

Objectives

  1. User-Friendly Interface — Simple, clean, and intuitive navigation for all users.
  2. Secure Authentication — Hashed passwords, role-based login for users and admin.
  3. Product Catalog — Dynamic listings with names, prices, descriptions, and images.
  4. Shopping Cart System — Add, update, remove items; real-time totals.
  5. Order Placement & Checkout — Smooth checkout with order records in database.
  6. Structured Database — Normalized MySQL schema for all entities.
  7. Basic Security Features — Input validation, session management, XSS protection.

Tools & Technologies

PHP 7.4+ MySQL 5.7+ HTML5 / CSS3 JavaScript Bootstrap Apache (XAMPP/WAMP) phpMyAdmin VS Code Windows / Linux

System Analysis

Need Identification: Growing demand for affordable, open-source online shopping solutions for small businesses and students, where traditional manual processes are slow and error-prone.

Problem Statement: Absence of an integrated, cost-effective e-commerce system with secure user management, organized product catalog, and reliable order processing.

Feasibility Summary:

FeasibilityStatusRemarks
Technical✓ FeasiblePHP + MySQL are open-source, well-documented, platform-independent
Economic✓ FeasibleZero licensing cost; XAMPP for local development; shared hosting ~₹2-3K/yr
Operational✓ FeasibleSimple UI, no specialized training needed, 24×7 availability

Hardware & Software Specifications

Software Requirements

ComponentSpecification
Operating SystemWindows 10 / Linux / macOS
Web ServerApache (XAMPP / WAMP / LAMP)
LanguagePHP 7.4+
DatabaseMySQL 5.7+
FrontendHTML5, CSS3, JS, Bootstrap
BrowserChrome, Firefox, Edge (latest)
IDEVS Code / Sublime Text / PHPStorm

Hardware Requirements (Development)

ComponentMinimumRecommended
ProcessorIntel Core i3Intel Core i5 or higher
RAM4 GB8 GB or more
Storage250 GB HDD512 GB SSD
Display1024×7681920×1080 (Full HD)

System Design & Modules

The system contains 3 core modules:

Admin Module

Manage products, view orders, track users, update categories, handle deliveries and order status.

Products Module

Store product names, images, prices, categories, subcategories, availability and discount info.

User Module

Register, login, browse products, add to cart, manage wishlist, checkout, view order history.

Database Structure (Tables)

users

FieldTypeDescription
user_idINT PK AIUnique user ID
usernameVARCHAR(50)User's name
emailVARCHAR(100)User's email (unique)
passwordVARCHAR(255)Hashed password
created_atDATETIMERegistration date/time

products

FieldTypeDescription
product_idINT PK AIUnique product ID
product_nameVARCHAR(100)Product name
descriptionTEXTProduct description
priceDECIMAL(10,2)Selling price
imageVARCHAR(255)Image path/URL
stockINTAvailable stock quantity
categoryVARCHAR(50)Product category

cart & orders (summary)

TableKey Fields
cartcart_id, user_id (FK), product_id (FK), quantity, added_at
ordersorder_id, user_id (FK), order_date, total_amount, status
order_itemsitem_id, order_id (FK), product_id (FK), quantity, price
adminadmin_id, username, password (hashed)

Process Logic — Key Workflows

1
User RegistrationFill form → Validate email uniqueness → Hash password (password_hash()) → Insert to users → Redirect to login.
2
User LoginSubmit email+password → Fetch from DB → password_verify() → Create session (user_id, name) → Redirect to dashboard.
3
Add to CartClick "Add to Cart" → Check if product exists in session cart → Increment qty or add new entry → Update cart table → Show success.
4
Checkout ProcessReview cart → Confirm order → Insert into orders table → Loop cart items into order_items → Clear cart → Show order summary.
5
Admin Product ManagementAdmin login → Add/Edit/Delete product → Changes reflect immediately on user-facing pages.

GUI Screens Implemented

The following pages are part of the system:

🖥️ Home Page (Product Listing)
🔐 User Login & Registration
🛍️ Category-wise Products
🔍 Search Results
📦 Product Details Page
🛒 Shopping Cart
📍 Checkout (Billing & Shipping)
💳 Payment Page
📋 Order History & Details
❤️ Wish List
👤 User Profile / My Account
❌ Order Cancellation
🔑 Forgot Password
📍 Manage Addresses
🛠️ Admin Panel (Products, Orders)
📊 Admin Reports & Tracking

Testing

System testing was performed across three dimensions: code efficiency, optimization, and validation. All 12 test cases passed.

Test IDModuleDescriptionStatus
TC001RegistrationValid registration inputsPass
TC002RegistrationInvalid email formatPass
TC003LoginCorrect credentialsPass
TC004LoginWrong password errorPass
TC005Booking/OrderValid order placementPass
TC006BookingInvalid date rejectionPass
TC007PaymentSuccessful payment flowPass
TC008FeedbackSubmit feedback after orderPass
TC009AdminAdd new productPass
TC010SecuritySQL injection attempt blockedPass
TC011PerformancePage loads under 3 secondsPass
TC012OptimizationCode reuse across modulesPass

Security Measures

  • 🔒Authentication & Authorization — Hashed passwords (password_hash/password_verify), role-based access control (Admin/User)
  • 🔒Session Management — Session timeout, ID regeneration, secure PHP sessions
  • 🛡️SQL Injection Protection — Prepared statements & proper input escaping
  • 🛡️XSS Protection — Output sanitized via htmlspecialchars(); script inputs filtered
  • Input Validation — Client-side (HTML5/JS) and server-side (PHP) validation
  • 📁Secure File Uploads — File type/size checks; uploaded files stored in protected folders
  • 🔐HTTPS — SSL certificate for encrypted data transfer in production
  • 🛠️Admin Panel Security — Restricted access, hidden URL, session-controlled entry

Cost Estimation

ComponentEstimated Cost (INR)
Domain & Hosting₹2,000 – ₹3,000 / year
Development ToolsFree (PHP, MySQL, XAMPP)
Design (HTML/CSS/Bootstrap)Free / Minimal
Developer Time (if outsourced)₹10,000 – ₹15,000
Testing & Debugging₹2,000 (manual)
Maintenance & Updates₹1,000 – ₹2,000 / year
Total (Professional)₹15,000 – ₹20,000
Total (Student / Self)₹2,000 – ₹5,000

Future Scope

  • Payment gateway integration (UPI, Debit/Credit Card, Net Banking)
  • Advanced admin dashboard with analytics and performance reports
  • Mobile-responsive design with Bootstrap or PWA
  • Product search and filters (price, category, rating)
  • Email/SMS notifications for orders and promotions
  • User reviews and star ratings for products
  • Inventory auto-alerts for low stock

Conclusion

The project "Online Shopping Website Using PHP and MySQL" successfully demonstrates a dynamic, user-friendly, and secure e-commerce platform. Using open-source technologies (PHP + MySQL), it is cost-effective and easy to implement. The system covers the full e-commerce lifecycle — from registration and product browsing to cart management, order placement, and admin control.

This project bridges theoretical knowledge with real-world application and provides a strong foundation for future enhancements including payment gateways, analytics dashboards, and mobile optimization.