# 🚀 Supernova 2.0 — Production Hosting Guide

## 📦 What to Upload to Server

Upload **everything inside `public_html/`** to your server's web root (usually `public_html/` or `www/` or `htdocs/`).

Also upload these **root-level files** separately (keep outside web root):
- `database.sql` → Import via phpMyAdmin
- `composer.json`, `composer.lock` → For running `composer install` on server
- `config/smtp.php` → Email configuration

---

## 🗂️ Final Clean Project Structure

```
Supernova 2026/
├── database.sql               ← Import this once in phpMyAdmin
├── composer.json              ← PHP dependencies list
├── composer.lock              ← Locked dependency versions
├── composer.phar              ← Composer binary (optional on server)
├── config/
│   └── smtp.php               ← Gmail SMTP credentials
├── README.md
├── .gitignore
└── public_html/               ← Upload this entire folder to server web root
    ├── index.php              ← Homepage
    ├── gallery.php            ← Gallery page
    ├── register.php           ← Event registration form
    ├── create_order.php       ← Razorpay order creation
    ├── verify_payment.php     ← Razorpay payment verification
    ├── admin/                 ← Admin dashboard & management
    ├── organizer/             ← Organizer dashboard
    ├── finance/               ← Finance/payment portal
    ├── attendance/            ← QR attendance scanner
    ├── certificates/          ← Certificate generator & verifier
    ├── events/                ← Events listing & detail pages
    ├── api/                   ← REST API endpoints
    ├── registration/          ← (Folder for runtime files)
    ├── exports/               ← (Folder for generated exports)
    ├── uploads/
    │   └── .htaccess          ← Security: blocks direct PHP execution in uploads
    ├── includes/
    │   ├── config.php         ← DB credentials & APP_URL — EDIT THIS
    │   ├── database.php       ← PDO connection handler
    │   ├── auth.php           ← Session & role authentication
    │   └── mail/              ← PHPMailer email service
    ├── assets/
    │   ├── css/               ← Compiled Tailwind CSS + gallery CSS
    │   ├── js/                ← All JavaScript files
    │   ├── img/               ← All images (gallery, events, logos)
    │   ├── docs/              ← SUPERNOVA BOOKLET.pdf
    │   └── videos/            ← Event/gallery videos
    └── vendor/                ← PHP Composer packages (PHPMailer, etc.)
```

---

## ⚙️ Step-by-Step Hosting Setup

### Step 1 — Create MySQL Database
In your hosting panel (cPanel / Hostinger):
1. Go to **MySQL Databases**
2. Create a new database: `supernova_db`
3. Create a DB user and assign **All Privileges** to it
4. Note the **host, username, password, database name**

---

### Step 2 — Import the Database
1. Open **phpMyAdmin**
2. Select your `supernova_db` database
3. Click **Import** tab
4. Upload `database.sql` and click **Go**
5. ✅ All 10 tables + 9 events + 5 users will be created automatically

---

### Step 3 — Edit `public_html/includes/config.php`

Open the file and update these values:

```php
// Database Configuration
defined('DB_HOST') || define('DB_HOST', 'localhost');      // usually localhost
defined('DB_USER') || define('DB_USER', 'your_db_user');   // your DB username
defined('DB_PASS') || define('DB_PASS', 'your_db_pass');   // your DB password
defined('DB_NAME') || define('DB_NAME', 'supernova_db');   // your DB name

// Application URL — NO trailing slash
defined('APP_URL')  || define('APP_URL',  'https://yourdomain.com');
defined('APP_NAME') || define('APP_NAME', 'Supernova 2.0');
```

---

### Step 4 — Edit `config/smtp.php` (for confirmation emails)

```php
define('SMTP_HOST',     'smtp.gmail.com');
define('SMTP_PORT',     587);
define('SMTP_USER',     'your-email@gmail.com');
define('SMTP_PASS',     'your-gmail-app-password');  // Gmail App Password (not login password)
define('SMTP_FROM',     'your-email@gmail.com');
define('SMTP_FROM_NAME','Supernova 2.0');
```

> To get a Gmail App Password: Google Account → Security → 2-Step Verification → App Passwords

---

### Step 5 — Upload Files via FTP / File Manager
1. Upload the entire contents of `public_html/` to your server's web root folder
2. Make sure the folder structure is preserved exactly

---

### Step 6 — Install PHP Dependencies (if server supports SSH)
```bash
cd /path/to/your/public_html
composer install --no-dev
```
If SSH is not available, upload the `vendor/` folder directly via FTP.

---

### Step 7 — Set Folder Permissions
```bash
chmod 755 public_html/
chmod 755 public_html/uploads/
chmod 755 public_html/exports/
chmod 755 public_html/registration/
```

---

### Step 8 — Configure Razorpay (for live payments)
In `public_html/includes/config.php`:
```php
define('RAZORPAY_KEY_ID',     'rzp_live_YOUR_KEY_ID');
define('RAZORPAY_KEY_SECRET', 'YOUR_KEY_SECRET');
```

---

## 🔐 Default Login Credentials

| Role | Email | Password |
|:---|:---|:---|
| **Admin** | sushantw3124@gmail.com | FinalPro213# |
| **Admin** | mh20agnes@gmail.com | Timex+44 |
| **Legacy Admin** | SuperNovaAD@mgm.org | SNadmin123 |
| **Organizer** | SuperNovaOL@mgm.org | SNorganizer123 |
| **Finance** | SuperNovaFL@mgm.org | SNfinance123 |

> ⚠️ **Change all passwords immediately after first login on production!**

---

## ✅ Pre-Launch Checklist

- [ ] Database imported successfully (`supernova_db` with 10 tables)
- [ ] `config.php` — DB credentials updated with production values
- [ ] `config.php` — `APP_URL` set to your live domain (no trailing slash)
- [ ] `config/smtp.php` — Gmail App Password configured
- [ ] `vendor/` folder uploaded or `composer install` run
- [ ] Razorpay live keys configured
- [ ] Folder permissions set (755 for uploads, exports, registration)
- [ ] Admin password changed after first login
- [ ] Test a registration end-to-end
- [ ] Test confirmation email delivery

---

## 🌐 Live Pages After Hosting

| Page | URL |
|:---|:---|
| Home | `https://yourdomain.com/` |
| Gallery | `https://yourdomain.com/gallery.php` |
| Events | `https://yourdomain.com/events/` |
| Register | `https://yourdomain.com/register.php` |
| Admin | `https://yourdomain.com/admin/` |
| Organizer | `https://yourdomain.com/organizer/` |
| Finance | `https://yourdomain.com/finance/` |
| Attendance | `https://yourdomain.com/attendance/` |

---

## 📞 PHP Requirements
- PHP **8.0+**
- MySQL **5.7+** or MariaDB **10.3+**
- Extensions: `pdo_mysql`, `mbstring`, `openssl`, `json`
- Composer packages: `phpmailer/phpmailer`, `phpoffice/phpspreadsheet`
