# Ocampp (PHP + MySQL) – Namecheap cPanel deployment

## 1. Create the database (2 minutes)
cPanel -> **MySQL(R) Database Wizard**
1. Create a database (e.g. `ocampp`) -> cPanel adds your prefix: `myacct_ocampp`
2. Create a database user + strong password
3. Tick **ALL PRIVILEGES** and finish. Write down the three values.

## 2. Pick PHP 8.1+
cPanel -> **Select PHP Version** -> choose 8.1 or newer. Make sure `pdo_mysql` and `mbstring` are ticked.

## 3. Upload
1. Zip the contents of this folder (or upload the zip you received).
2. cPanel -> **File Manager** -> open `public_html` (or the folder of your domain/subdomain).
3. **Upload** the zip, right-click -> **Extract**. The files (`index.php`, `.htaccess`, `app/`, `assets/` ...) must sit directly inside the folder.
4. Enable **Settings -> Show Hidden Files (dotfiles)** to see `.htaccess`.

## 4. Install
Open `https://yourdomain.com/install.php`, enter the database details and the super admin login.
The installer creates all tables, saves `app/config.php` and deletes itself.

## 5. After install
* Sign in at `/auth` with the super admin email -> shield icon (top bar) or Profile -> **Admin panel**.
* Turn on HTTPS: cPanel -> SSL/TLS Status -> Run AutoSSL, then uncomment the 2 HTTPS lines in `.htaccess`.
* Folder permissions: folders 755, files 644; `uploads/products` must be writable (755 normally works).

## Admin features
* Admin panel -> Users: create customer / vendor / admin accounts, suspend, reset passwords, delete.
* Only the **super admin** can create or remove other admins.
* Listings: remove any listing. Orders: change order status (pending, confirmed, shipped, delivered, cancelled).

## Troubleshooting
* 500 error -> `.htaccess` upload incomplete or PHP < 7.4. Set `'debug' => true` in `app/config.php` temporarily.
* Pages 404 except home -> `.htaccess` missing (hidden file) or mod_rewrite off.
* Image upload fails -> make `uploads/products` writable.
* Installer says DB connection failed -> use the prefixed DB name/user from cPanel.

## Who can see what
| Visitor | Can open |
|---|---|
| Not signed in | Home page (products, search, categories) and product pages. Everything else sends them to Sign in. |
| Customer | Shop, services, deals, cart, orders, profile, wallet. Never sees seller names, store pages or the vendor directory. |
| Vendor | Everything a customer sees, plus seller names, vendor directory, store pages and their own dashboard. |
| Admin / super admin | Everything, plus the Admin panel. |

## Vendor verification
* New vendors start **unverified** and can publish only 3 listings (change `unverified_listing_limit` in `app/config.php`).
* Admin panel -> Users -> **Verify vendor** removes the limit. The Overview tab shows how many vendors are waiting.
* Vendors created or promoted by an admin are verified automatically.
* Sites installed earlier are upgraded automatically on the first page visit (adds the `vendor_verified` column; existing vendors start unverified).
