143 lines
4.2 KiB
Markdown
143 lines
4.2 KiB
Markdown
# AfgCars - Modern Automotive Marketplace
|
|
|
|
AfgCars is a robust, visually stunning automotive marketplace platform designed for the Afghan car market. It features a modern "glassmorphism" design, a powerful admin panel, and seamless car listing management for both individual sellers and administrators.
|
|
|
|
## 🚀 Quick Start (How to Run)
|
|
|
|
### 1. Database Setup
|
|
The application requires a MySQL/MariaDB database.
|
|
|
|
**Option A: Import SQL File (Recommended)**
|
|
1. Create a database named `app_38703` (or the name specified in `db/config.php`).
|
|
2. Import the `database.sql` file located in the `db/` directory:
|
|
```bash
|
|
mysql -u your_username -p app_38703 < db/database.sql
|
|
```
|
|
|
|
**Option B: Run Setup Script**
|
|
Alternatively, you can run the PHP setup script which creates the tables automatically:
|
|
```bash
|
|
php db/setup.php
|
|
```
|
|
|
|
### 2. Configuration
|
|
Ensure your database credentials in `db/config.php` are correct:
|
|
```php
|
|
define('DB_HOST', '127.0.0.1');
|
|
define('DB_NAME', 'app_38703');
|
|
define('DB_USER', 'your_user');
|
|
define('DB_PASS', 'your_password');
|
|
```
|
|
|
|
### 3. Launch
|
|
Open your web browser and navigate to the project root (e.g., `http://localhost/`).
|
|
|
|
---
|
|
|
|
## 🚀 Key Features
|
|
- **Modern UI/UX**: Clean, youthful, and inviting design with glassmorphism effects.
|
|
- **Admin Dashboard**: Full control over users, car listings, and customer messages.
|
|
- **User Dashboard**: Personal area for users to manage their own car listings.
|
|
- **Car Marketplace**: Advanced search and filtering for cars across various cities in Afghanistan.
|
|
- **Responsive Design**: Fully functional on mobile, tablet, and desktop devices.
|
|
- **Secure Authentication**: Robust registration and login system with role-based access control.
|
|
|
|
## 🛠️ Technology Stack
|
|
- **Backend**: PHP 8.x
|
|
- **Database**: MariaDB/MySQL
|
|
- **Frontend**: HTML5, CSS3 (Custom Glassmorphism Styles), JavaScript (Vanilla)
|
|
- **Email**: Integrated PHPMailer service
|
|
|
|
## 👤 Default Admin Account
|
|
Use these credentials to access the administrative panel:
|
|
- **Email**: `admin@gmail.com`
|
|
- **Password**: `12345678`
|
|
- **Role**: `admin`
|
|
|
|
## 📊 Entity Relationship Diagram (ERD)
|
|
|
|
```mermaid
|
|
erDiagram
|
|
USERS ||--o{ CARS : "posts"
|
|
USERS ||--o{ REVIEWS : "writes"
|
|
USERS ||--o{ PURCHASES : "makes"
|
|
CARS ||--o{ CAR_IMAGES : "has"
|
|
CARS ||--o{ REVIEWS : "receives"
|
|
CARS ||--o{ PURCHASES : "is_part_of"
|
|
|
|
USERS {
|
|
int id PK
|
|
string name
|
|
string email UK
|
|
string password
|
|
enum role "guest, user, admin"
|
|
enum status "active, inactive"
|
|
timestamp created_at
|
|
}
|
|
|
|
CARS {
|
|
int id PK
|
|
int user_id FK
|
|
string brand
|
|
string model
|
|
int year
|
|
decimal price
|
|
string city
|
|
text description
|
|
enum status "pending, approved, rejected, sold"
|
|
boolean is_hot_deal
|
|
timestamp created_at
|
|
}
|
|
|
|
CAR_IMAGES {
|
|
int id PK
|
|
int car_id FK
|
|
string image_path
|
|
boolean is_main
|
|
}
|
|
|
|
REVIEWS {
|
|
int id PK
|
|
int car_id FK
|
|
int user_id FK
|
|
int rating
|
|
text comment
|
|
enum status "pending, approved"
|
|
timestamp created_at
|
|
}
|
|
|
|
PURCHASES {
|
|
int id PK
|
|
int car_id FK
|
|
int user_id FK
|
|
string buyer_name
|
|
string buyer_email
|
|
string buyer_phone
|
|
enum status "pending, completed, cancelled"
|
|
timestamp created_at
|
|
}
|
|
|
|
CONTACT_MESSAGES {
|
|
int id PK
|
|
string name
|
|
string email
|
|
string subject
|
|
text message
|
|
enum status "unread, read, answered"
|
|
timestamp created_at
|
|
}
|
|
```
|
|
|
|
## 📁 Project Structure
|
|
- `index.php`: Landing page and marketplace hero.
|
|
- `cars.php`: Searchable list of all vehicles.
|
|
- `car_detail.php`: Detailed view of a single car with photo gallery.
|
|
- `admin_dashboard.php`: Entry point for administrative management.
|
|
- `dashboard.php`: User-specific panel for listing management.
|
|
- `db/`: Database configuration, setup scripts, and `database.sql` export.
|
|
- `assets/`: CSS, JS, and image assets.
|
|
- `includes/`: Reusable header and footer components.
|
|
- `mail/`: Built-in email service components.
|
|
|
|
## 📝 License
|
|
This project is built for educational and demonstration purposes. |