# Complete System Flow ## User Registration & Login Flow ``` ┌─────────────────────────────────────────────────────────────────┐ │ USER REGISTRATION │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────┐ │ Register Form │ │ (index.php) │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ auth_handler.php │ │ action=register │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Database │ │ is_approved = 0 │ ← PENDING by default └──────────────────┘ ┌─────────────────────────────────────────────────────────────────┐ │ ADMIN APPROVAL │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────┐ │ admin.php │ │ Login: admin123 │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Click "Approve" │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Database │ │ is_approved = 1 │ ← APPROVED └──────────────────┘ ┌─────────────────────────────────────────────────────────────────┐ │ USER LOGIN FLOW │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────┐ │ Login Form │ │ (index.php) │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ auth_handler.php │ │ action=login │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Check is_approved│ └──────────────────┘ │ ┌─────────────┼─────────────┐ │ │ │ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ Pending │ │ Hold │ │ Approved │ │ (= 0) │ │ (= 2) │ │ (= 1) │ └──────────┘ └──────────┘ └──────────┘ │ │ │ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ index.php│ │ index.php│ │dashboard │ │ Pending │ │ Hold │ │ .php │ │ Page │ │ Page │ │ │ └──────────┘ └──────────┘ └──────────┘ │ ▼ ┌──────────────┐ │ Fetch API │ │ Data from │ │ ccapi. │ │ rerrkvifj │ └──────────────┘ │ ▼ ┌──────────────┐ │ Display: │ │ - User BTC │ │ - Product │ │ Details │ │ - Live Data │ └──────────────┘ ``` ## Real-Time Status Updates ``` ┌─────────────────────────────────────────────────────────────────┐ │ REAL-TIME STATUS CHECKING │ │ (Every 5 seconds) │ └─────────────────────────────────────────────────────────────────┘ User on Pending/Hold Page │ ▼ ┌──────────────────┐ │ JavaScript │ │ setInterval │ │ (5000ms) │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ check_status.php │ │ Fetch current │ │ is_approved │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Status Changed? │ └──────────────────┘ │ Yes │ No │ └─► Continue checking ▼ ┌──────────────────┐ │ window.location │ │ .reload() │ └──────────────────┘ │ ▼ ┌──────────────────┐ │ Redirect to │ │ appropriate page │ │ (Pending/Hold/ │ │ Dashboard) │ └──────────────────┘ ``` ## Dashboard API Integration ``` ┌─────────────────────────────────────────────────────────────────┐ │ DASHBOARD.PHP LOADS │ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────┐ │ Check Session │ │ is_approved = 1? │ └──────────────────┘ │ Yes │ No → Redirect to index.php ▼ ┌──────────────────┐ │ Fetch API Data │ │ from ccapi │ │ (10s timeout) │ └──────────────────┘ │ ┌─────────┴─────────┐ │ │ Success Failure │ │ ▼ ▼ ┌──────────────┐ ┌──────────────┐ │ Parse JSON │ │ Use Default │ │ Extract: │ │ Values │ │ - name │ └──────────────┘ │ - totalScale │ │ │ - profit │ │ │ - leastTake │ │ │ - pattern │ │ │ - dates │ │ └──────────────┘ │ │ │ └─────────┬─────────┘ ▼ ┌──────────────────┐ │ Render HTML │ │ with Data: │ │ │ │ Product Details: │ │ - Current Scale │ │ - Realized P&L │ │ - Min Investment │ │ - Interest Model │ │ │ │ User Data: │ │ - BTC Address │ │ - WhatsApp │ │ - Telegram │ └──────────────────┘ ``` ## API Data Mapping ``` API Response Dashboard Display ───────────────────────────────────────────────────────── data.name → Product Title data.totalCurrentScale → Current Scale (BTC) data.totalRealizeProfit → Realized P&L (BTC) data.leastTake → Min investment (BTC) data.interestPattern → Interest-bearing model (T+1) data.compoundInterestAnnualYield → APY (Compound) % data.revenuePerTenThousand → 10K Share/Day data.progressBar → Participated % data.signDate → Agreement signing date data.effectDate → Agreement effective date data.grantDate → Earning distribution ``` ## File Structure ``` c:\xampp\htdocs\ │ ├── README.md ├── DASHBOARD_INTEGRATION.md │ ├── api/ │ ├── .htaccess │ ├── config.php │ ├── login.php │ ├── register.php │ └── setup.php │ └── frontend/ ├── admin.php ← Admin panel ├── auth_handler.php ← Login/Register handler ├── check_status.php ← Real-time status API ├── dashboard.php ← NEW: Dashboard with API ├── first.html ← Terms page (original) ├── index.php ← Main app (redirects approved) └── logout.php ← Logout handler ``` ## Summary ✅ **Approved Users** → Automatically redirected to `dashboard.php` ✅ **Dashboard** → Fetches live data from API ✅ **Product Details** → Displays API data (Current Scale, P&L, etc.) ✅ **User Data** → Shows BTC address, WhatsApp, Telegram ✅ **Real-time** → Status updates every 5 seconds ✅ **Fallback** → Default values if API fails ✅ **Session** → Protected, only approved users can access