A legacy PHP and MySQL online store project built while learning web application development, then cleaned up and containerized with Docker for easier local setup and portfolio review.
The project focuses on practical e-commerce workflows: product browsing, authentication, cart and checkout, order tracking, articles, and admin management screens.
- PHP 8.2
- MySQL 8
- Apache
- HTML/CSS
- Bootstrap
- JavaScript
- jQuery
- Docker Compose
- Product catalog and product detail pages
- Category-based product browsing
- Search by product name/description
- User registration and login
- Password hashing with
password_hash - Role-based admin access
- Shopping cart
- Checkout and order creation
- Order status tracking
- Article/blog pages
- Admin product management
- Admin order processing
- Admin statistics page
Admin
Username: admin
Password: admin123
User
Username: user
Password: user123
Start the application:
docker compose up -d --buildOpen the customer site:
http://localhost:8080/html/home.php
Open the admin area:
http://localhost:8080/admin/admin.php
Open phpMyAdmin:
http://localhost:8081
Docker database credentials:
Host: db
Database: songtai_shop
Username: songtai_user
Password: songtai_password
Root password: root
Reset the database volume and re-import the seed data:
docker compose down -v
docker compose up -d --build- Place the project in your local PHP server directory, for example:
htdocs/php-online-store
- Import the SQL file:
database/songtai_shop.sql
- Create local config:
cp config/config.example.php config/config.php-
Update
config/config.phpwith your local MySQL credentials. -
Open:
http://localhost/php-online-store/html/home.php
admin/ Admin screens for products, orders, articles, and statistics
class_models/ PHP classes for users, products, articles, admin, and control logic
config/ Database config and auth helper
css/ Custom styles and Bootstrap CSS
database/ MySQL schema and seed data
docs/ Git flow notes and screenshots
html/ Customer-facing pages
images_baiviet/ Article images
images_sanpham/ Product images and UI assets
js/ JavaScript and library files
The Docker setup imports:
database/songtai_shop.sql
Main tables:
thongtin_nguoidungsanphamgiohangnguoidungdonhang0chitietdonhang0baiviet
This was originally a hand-coded XAMPP learning project. Recent cleanup focused on making it safer and easier to review:
- Added Docker development environment
- Added seed database for reproducible setup
- Moved local DB credentials out of Git
- Added
config/config.example.php - Added
config/auth.php - Added admin role checks
- Changed product deletion from GET to POST
- Added safer JavaScript alert rendering with
json_encode - Added basic upload validation with
getimagesize - Escaped several admin outputs with
htmlspecialchars
Run PHP syntax checks inside the app container:
docker compose exec app sh -lc 'find admin class_models config html -name "*.php" -print0 | xargs -0 -n1 php -l'Smoke-tested pages:
/html/home.php
/html/store.php
/html/baiViet.php
/html/chitietsanpham.php?idsp=1
/html/chitietbaiviet.php?id=1
This repository follows a lightweight Git Flow:
main: stable code for release/demodevelop: daily development branchfeature/*: one branch per feature or improvementrelease/*: release preparationhotfix/*: urgent fixes frommain
See docs/git-flow.md.
This project is a learning/portfolio project, not a production-ready e-commerce system. The goal is to demonstrate practical PHP, MySQL, CRUD workflows, authentication, admin management, Docker setup, and incremental cleanup of a legacy codebase.

