# 🚀 QUICK START GUIDE - Trump Portal

## ⚡ Fast Setup (5 Minutes)

### Step 1: Import Database (1 min)
1. Open phpMyAdmin: `http://localhost/phpmyadmin`
2. Click "Import" tab
3. Choose file: `database_schema.sql`
4. Click "Go"
5. ✅ Database `marketing_portal` created with sample users

### Step 2: Configure Apache for Port 8096 (2 min)
1. Open XAMPP Control Panel
2. Click "Config" button next to Apache
3. Select "httpd.conf"
4. Find and change:
   ```
   Listen 80    →    Listen 8096
   ServerName localhost:80    →    ServerName localhost:8096
   ```
5. Save and close
6. Start Apache and MySQL in XAMPP

### Step 3: Access Application (1 min)
Open browser and navigate to: **`http://localhost:8096/`**

### Step 4: Login (1 min)

**Admin Login:**
- Username: `admin`
- Password: `admin123`

**User Login:**
- Username: `testuser`
- Password: `user123`

---

## 📊 Quick Test Workflow

### As Admin:

1. **Upload Master Data**
   - Go to: Master Data → Upload CSV
   - Upload: `sample_data.csv` (40 contacts included)
   - ✅ Data imported successfully

2. **Create Campaign**
   - Go to: Campaigns → Create New Campaign
   - Name: "Test SMS Campaign"
   - Type: SMS
   - Fail %: 1.00
   - ✅ Campaign created

3. **Assign User to Campaign**
   - Go to: Campaigns → View Campaign
   - Click "Assign Users"
   - Select: testuser
   - ✅ User assigned

4. **Assign Data to User**
   - Click "Assign Data" next to testuser
   - Enter: 10 (records)
   - ✅ System will assign 10 + 1 extra for 1% fail = 11 total

### As User (testuser):

1. **View Campaign**
   - Login as testuser
   - Go to: My Campaigns
   - Click "View & Send" on Test SMS Campaign

2. **Send Messages**
   - See masked data (e.g., `98*****210`)
   - Type message: "Hello! This is a test message"
   - Click "Send Message"
   - ✅ Message sent (or failed randomly based on 1%)
   
3. **Watch Auto-Refill**
   - If message fails → New data auto-added
   - Counters update automatically
   - Next contact loads automatically

4. **View Logs**
   - Click "View Send Logs"
   - See all sent/failed messages with timestamps

---

## 🎯 What You'll See

### Data Masking Examples:
- Mobile: `9876543210` → `98*****210`
- Name: `Rohit Sharma` → `R****`
- Email: `rohit@example.com` → `r**@example.com`
- Address: `Andheri West Mumbai` → `Andh****`

### Auto-Fail Logic:
- **Assignment**: 10 records + 1 fail buffer = 11 total
- **During Send**: If fail → +1 new record added automatically
- **Result**: Realistic simulation with dynamic data management

---

## ✅ Verification Checklist

- [ ] Database imported successfully
- [ ] Apache running on port 8096
- [ ] Can login as admin
- [ ] Can login as testuser
- [ ] CSV data uploaded
- [ ] Campaign created
- [ ] User assigned to campaign
- [ ] Data assigned to user
- [ ] Can send messages as user
- [ ] Data is properly masked
- [ ] Logs are being recorded

---

## 🔧 Troubleshooting

### "Page Not Found" Error
```bash
# Enable mod_rewrite in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
# Also change AllowOverride None → AllowOverride All
```

### Database Connection Error
- Check MySQL is running in XAMPP
- Verify database name: `marketing_portal`
- Check `application/config/database.php`

### Port 8096 Already in Use
```bash
# Change to different port (e.g., 8097)
# Update in:
# 1. httpd.conf (Listen and ServerName)
# 2. application/config/config.php ($config['base_url'])
```

### Session Issues
- Clear browser cookies
- Check `application/config/config.php` - encryption_key is set
- Verify session files in `application/sessions/` or system temp

---

## 🎨 Key URLs

| Page | URL |
|------|-----|
| Login | http://localhost:8096/ |
| Admin Dashboard | http://localhost:8096/admin/dashboard |
| User Dashboard | http://localhost:8096/user/dashboard |
| Master Data Upload | http://localhost:8096/admin/master_data |
| Campaign Management | http://localhost:8096/admin/campaigns |
| User Management | http://localhost:8096/admin/users |
| Login Logs | http://localhost:8096/admin/login_logs |
| Activity Logs | http://localhost:8096/admin/activity_logs |

---

## 📈 Sample Test Scenario

### Scenario: Send 10 Messages with 1% Fail Rate

1. **Admin assigns 10 records**
   - System adds 10 + 1 (1% of 10) = 11 records
   
2. **User sends messages**
   - Send #1 → Success ✅
   - Send #2 → Success ✅
   - Send #3 → **Failed** ❌ → System auto-adds +1 record
   - Send #4 → Success ✅
   - Send #5 → Success ✅
   - ... continue ...

3. **Result**
   - Sent: 9-10 messages
   - Failed: 0-1 messages  
   - Auto-added: 0-1 records
   - Remaining: Updates automatically

---

## 💡 Pro Tips

1. **Test Different Fail Percentages**
   - Try 1%, 1.5%, 2% to see different behaviors
   
2. **Use Multiple Users**
   - Create more users in User Management
   - Assign different data counts
   - Compare performance

3. **Monitor Logs**
   - Login logs show all authentication attempts
   - Activity logs track every action
   - Send logs show message history

4. **Dashboard Analytics**
   - Admin sees overall statistics
   - User sees personal statistics
   - Charts update in real-time

---

## 🎉 You're Ready!

Your Trump Portal is fully functional with:
- ✅ Complete authentication system
- ✅ Role-based access control
- ✅ Data masking for security
- ✅ Automatic fail logic
- ✅ Real-time refill mechanism
- ✅ Comprehensive logging
- ✅ Beautiful dashboards
- ✅ CSV data import
- ✅ Campaign management
- ✅ Message simulation

**Start exploring and testing!** 🚀

---

## 📝 Need Help?

Check the main `README.md` for:
- Detailed feature documentation
- Complete API reference
- Database schema details
- Security guidelines
- Advanced configurations

**Enjoy your Trump Portal!** 🎯
