# TOPBD — Hostinger & cPanel Deployment Guide

Follow this simple 4-step deployment guide to deploy **TOPBD** on any shared hosting provider (Hostinger, cPanel, Namecheap, Bluehost, DirectAdmin, or VPS) running PHP 8.0+ and MySQL 5.7+ / MariaDB 10.3+.

---

## Step 1: Create a MySQL Database & User
1. Log in to your **cPanel** or **Hostinger hPanel**.
2. Navigate to **MySQL Databases** / **Databases**.
3. Create a new database (e.g., `u123456_topbd`).
4. Create a database user (e.g., `u123456_admin`) with a secure password.
5. Grant **ALL PRIVILEGES** to the user for the created database.

---

## Step 2: Upload Files
1. Open **File Manager** in cPanel / Hostinger.
2. Navigate to `public_html` (or your subdomain directory).
3. Upload all files from the `standalone-php` folder (or unzip `TOPBD-STANDALONE.zip`).
4. Ensure the `uploads/` directory has write permissions (`chmod 755` or `chmod 775`).

---

## Step 3: Run the 1-Click Installer
1. Open your browser and navigate to:
   ```
   https://yourdomain.com/installer.php
   ```
2. Enter your MySQL database credentials:
   - **Database Host**: `localhost` (or Hostinger DB IP)
   - **Database Name**: (from Step 1)
   - **Database Username**: (from Step 1)
   - **Database Password**: (from Step 1)
3. Set your desired **Admin Username**, **Email**, and **Password**.
4. Click **Install TOPBD Database & Complete Setup**.
5. The installer will automatically:
   - Verify connection
   - Execute table schema
   - Seed default categories and initial data
   - Provision hashed admin account
   - Generate `config.php`
   - Secure the `uploads/` folder

---

## Step 4: Configure Bangladeshi Payment Gateways
1. Log in to the Admin Dashboard at:
   ```
   https://yourdomain.com/admin/login.php
   ```
2. Navigate to **Payment Gateways**.
3. Enter your live or sandbox API merchant keys for:
   - **bKash** (App Key, App Secret, Username, Password)
   - **Nagad** (Merchant ID, Public Key, Private Key)
   - **Rocket** (DBBL Merchant Key)
   - **SSLCommerz** (Store ID, Store Password)
   - **shurjoPay** (Merchant ID, Username, Password)
4. Toggle gateway mode from **Sandbox (Test)** to **Live (Production)** when ready.

---

## Security Best Practices
- Delete or rename `installer.php` after installation completes.
- Keep PHP version set to **8.1+** or **8.2+** for maximum speed.
- SSL Certificate (HTTPS) is recommended for payment gateway callbacks.
