# Championship System - Deployment Checklist

## ✅ What's Already Done

- [x] All file paths updated for `/champ/` subdirectory
- [x] Database connection points to `../conn.php`
- [x] Authentication points to `../logged_in.php`
- [x] CSS/JS paths point to parent directory
- [x] SQL schema ready to run
- [x] All 3 PHP files ready to upload

## 📋 Your To-Do List

### 1. Create Directory (2 minutes)
```bash
cd /var/www/gamesys.teamtrivia.com/
mkdir champ
chmod 755 champ
```

### 2. Upload Files (5 minutes)
Upload to `/var/www/gamesys.teamtrivia.com/champ/`:
- [ ] championship_api.php
- [ ] championship_dashboard.php
- [ ] championship_chat.php

```bash
chmod 644 champ/*.php
```

### 3. Run Database Schema (2 minutes)
```bash
mysql -u your_user -p your_db < championship_schema.sql
```

Creates these tables:
- tournament_status
- championship_notifications
- championship_chat
- championship_presence

### 4. Test It (5 minutes)
Visit these URLs:

**Dashboard:**
```
https://gamesys.teamtrivia.com/champ/championship_dashboard.php?tourn_ID=1
```

**Chat:**
```
https://gamesys.teamtrivia.com/champ/championship_chat.php?tourn_ID=1&username=Test
```

**API:**
```
https://gamesys.teamtrivia.com/champ/championship_api.php?action=get_championship_status&tourn_ID=1
```

### 5. Optional: Add Test Data
If you want to see it in action with sample data:
```sql
INSERT INTO tournament_status 
(tourn_ID, loc_ID, location_name, region_name, game_date, total_teams) 
VALUES 
(1, 101, 'Test Location 1', 'Colorado', CURDATE(), 12),
(1, 102, 'Test Location 2', 'Colorado', CURDATE(), 8);
```

Then refresh the dashboard - you'll see 2 locations!

## 🎯 Total Time Estimate
**15-20 minutes** from start to tested and working

## 📁 Files Included

1. **championship_api.php** - Backend API (all endpoints)
2. **championship_dashboard.php** - Real-time status dashboard
3. **championship_chat.php** - Improved chat system
4. **championship_schema.sql** - Database tables
5. **DEPLOYMENT_GUIDE.md** - Complete instructions
6. **This checklist!**

## 🔧 Integration (Later)

When ready to integrate with your main nav.php:
- Add championship buttons (see DEPLOYMENT_GUIDE.md)
- Add heartbeat code (keeps location online)
- Add finalization buttons (locks scores)

But you can **test everything first** without touching your main system!

## ❓ Questions?

- Dashboard not loading? Check Apache error log
- Database errors? Verify schema ran successfully
- CSS not loading? Check that /css/ exists in parent directory
- API returning errors? Check conn.php and logged_in.php paths

See **DEPLOYMENT_GUIDE.md** for detailed troubleshooting.

---

## Quick Command Reference

```bash
# Navigate to web root
cd /var/www/gamesys.teamtrivia.com/

# Create champ directory
mkdir champ && chmod 755 champ

# Upload files, then set permissions
chmod 644 champ/*.php

# Run database schema
mysql -u user -p database < championship_schema.sql

# Check if tables were created
mysql -u user -p database -e "SHOW TABLES LIKE 'championship%';"

# View Apache errors (if needed)
tail -f /var/log/apache2/error.log
```

---

**Ready to go!** 🚀

All files are updated and configured for your `/champ/` folder setup. 
Just upload, run SQL, and test!
