https://github.com/pnv2003/sailor-moon-store
An online clothing store web application built by HCMUT Sailor Moon Team, Database Systems Assignment, Fall 2023
https://github.com/pnv2003/sailor-moon-store
database database-systems mysql php sql web
Last synced: 4 months ago
JSON representation
An online clothing store web application built by HCMUT Sailor Moon Team, Database Systems Assignment, Fall 2023
- Host: GitHub
- URL: https://github.com/pnv2003/sailor-moon-store
- Owner: pnv2003
- Created: 2023-11-20T03:32:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-10T18:49:17.000Z (about 2 years ago)
- Last Synced: 2025-02-25T17:45:21.023Z (about 1 year ago)
- Topics: database, database-systems, mysql, php, sql, web
- Language: PHP
- Homepage:
- Size: 951 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sailor-moon-store
An online clothing store web application made for the Database Systems course of HCMUT
## Dữ liệu mẫu
- 3 khu vực: Hà Nội (3 chi nhánh), Đà Nẵng (2 chi nhánh), TP.HCM (1 chi nhánh)
- Mỗi chi nhánh có 16 nhân viên, bao gồm:
- 1 quản lý
- 3 ban kế toán, giao hàng, bán hàng
- Mỗi ban có 1 trưởng ban, 4 nhân viên cấp dưới
## Cấu trúc mã nguồn
```
├── config (cấu hình: database)
├── database (chứa lệnh SQL)
├── public (chứa các view/page: trang chủ index.php, trang sản phẩm, ...)
└── src
├── inc (chứa mẫu header, footer: truy xuất bằng hàm view() như trong index.php)
├── libs (chứa các hàm phụ trợ, thường dành cho form)
├── models (chứa class lưu thông tin database)
├── controllers (xử lý phía server, thường dành cho form)
```
Xử lý form trong PHP xem thêm tại: https://www.phptutorial.net/php-tutorial/php-registration-form/
### Cập nhật Keep It Simple
Xóa các thư mục `public`, `src`, `.htaccess`, `database` -> `sql`
Các page được hiện thực trực tiếp trên root folder:
| Page | Description |
|-|-|
| `index.php` | Trang chủ, link tới 4 trang còn lại |
| `product.php` | Trang sản phẩm |
| `cart.php` | Giỏ hàng (có thể để chung vào `product.php` nếu có thể) |
| `bill.php` | Quản lý hóa đơn |
| `employee.php` | Quản lý nhân viên |
| `stat.php` | Trang thống kê |
Các file CSS, JavaScript được gom vào các thư mục `css` và `js`.
## Hướng dẫn kết nối PHP - SQL Server
Cài đặt:
1. Chạy lệnh `create.sql`, `insert.sql` trong `database/` trong SSMS để thêm dữ liệu
2. Cài đặt PHP (có thể dùng XAMPP)
3. Tải driver PHP SQL Server tại: [Download the Microsoft Drivers for PHP for SQL Server](https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver16),
giải nén và copy các file `php_pdo_sqlsrv_82_ts_x64.dll` và `php_sqlsrv_82_ts_x64.dll` vào `C:/php/ext` (hoặc `C:/xampp/php/ext`)
4. Truy cập folder gốc (`C:/php` hoặc `C:/xampp/php`) chỉnh sửa file `php.ini` -> thêm các dòng sau:
```ini
extension=php_sqlsrv_82_ts_x64.dll
extension=php_pdo_sqlsrv_82_ts_x64.dll
```
Kết nối:
5. Vào file `config/database.php`, nhập các constant HOST (thường là ADMIN), NAME (SailorMoonStore), USER, PASSWORD (tài khoản SQL Server)
6. Tạo model trong `src/models/`, mẫu model cho bảng Region xem trong file `region.php`
7. Thêm `require_once __DIR__ . '/models/'` vào `src/bootstrap.php`
8. Sử dụng model để truy xuất dữ liệu, minh họa trong `public/index.php`
9. Chạy thử: dùng lệnh `php -S` hoặc dùng XAMPP
Xem thêm về PHP: [PHP Tutorial](https://www.phptutorial.net/)
Xem thêm về PHP PDO - thư viện kết nối CSDL: [PHP PDO Tutorial](https://www.phptutorial.net/php-pdo/)
### Cập nhật MySQL:
- Kết nối PHP - MySQL: xem trong PHP tutorial ở các trang tutorial trên
- Xem thêm về MySQL: [MySQL Tutorial](https://www.mysqltutorial.org/)