# De Vendor — Sign Up & Marketplace Setup

This adds client accounts, a listing submission form, an admin review
panel, and a public marketplace to your site. Follow these steps in order.

## 1. Create the database in cPanel

1. Log into cPanel → **MySQL Databases**.
2. Under "Create New Database," name it something like `devendor` and
   click Create. cPanel will prefix it automatically, e.g.
   `yourcpanelusername_devendor` — note the full name.
3. Under "MySQL Users," create a new user with a strong password. Note
   the full username too (also prefixed, e.g. `yourcpanelusername_dbuser`).
4. Under "Add User to Database," add that user to the database you just
   created, and give it **All Privileges**.

## 2. Import the schema

1. In cPanel, open **phpMyAdmin**.
2. Click your new database in the left sidebar.
3. Click the **Import** tab, choose the file `schema.sql` from this
   package, and click **Go**.
4. You should now see three tables: `clients`, `listings`, `admins`.

## 3. Edit config.php

Open `config.php` in a text editor and fill in the three values from
step 1:

```php
define('DB_HOST', 'localhost');
define('DB_NAME', 'yourcpanelusername_devendor');
define('DB_USER', 'yourcpanelusername_dbuser');
define('DB_PASS', 'the-password-you-set');
```

Save the file.

## 4. Upload everything to your site

1. In cPanel **File Manager**, go to `public_html` (or wherever your
   site currently lives).
2. Upload this entire package and extract it there, so the new PHP
   files sit alongside your existing `index.html`. It should include:
   - `index.html`, `signup.php`, `login.php`, `logout.php`,
     `dashboard.php`, `listings.php`, `admin-login.php`, `admin.php`,
     `logout-admin.php`, `create-admin.php`, `config.php`, `schema.sql`
   - the `includes/` folder (`header.php`, `footer.php`)
   - the `assets/` folder (`style.css` and `images/`)
3. Overwrite your existing `index.html` with the new one in this
   package — it has the updated menu linking to the new pages.

## 5. Create your admin account (one time)

1. Visit `yourdomain.com/create-admin.php` in your browser.
2. Enter a username and password for yourself — this is separate from
   client accounts, and is what lets you review listings.
3. Click Create Account.
4. **Immediately after, delete `create-admin.php` from cPanel File
   Manager.** Leaving it live would let anyone create an admin login.

## 6. Test it end to end

1. Visit `yourdomain.com/signup.php` and create a test client account.
2. You'll land on the dashboard — submit a test listing.
3. Visit `yourdomain.com/admin-login.php` and log in with the admin
   account from step 5.
4. Approve the test listing.
5. Visit `yourdomain.com/listings.php` — the approved listing should
   now appear publicly.
6. Delete the test client/listing from phpMyAdmin once you've confirmed
   it all works (or just leave it — up to you).

## What each page does

| Page | Purpose |
|---|---|
| `signup.php` | New clients create an account |
| `login.php` | Returning clients log in |
| `dashboard.php` | Logged-in clients submit listings, see their status |
| `listings.php` | Public marketplace — approved listings only |
| `admin-login.php` | Your private login |
| `admin.php` | Approve, reject, or delete submitted listings |

## If something doesn't work

- **"Database connection failed"** → double-check the values in
  `config.php` character-for-character against cPanel → MySQL Databases.
- **Blank white page** → your host may be running an older PHP version.
  In cPanel, go to **MultiPHP Manager** and set your domain to PHP 8.0
  or higher.
- **Styles look broken** → make sure the `assets/` folder uploaded
  completely, including the `images/` subfolder.
