========================================
TFL LEADS PRO — LICENSE BACKEND SETUP
========================================

FILES:
- config.php     → DB + admin password config (EDIT THIS FIRST)
- install.php    → Run once to create DB tables (DELETE after)
- validate.php   → Extension calls this to check keys
- admin.php      → Web panel to generate/manage keys
- .htaccess      → Protects config.php

========================================
SETUP STEPS (cPanel):
========================================

1) SUBDOMAIN BANAO
   cPanel → Subdomains → license.yourdomain.com (or any name)

2) MYSQL DATABASE BANAO
   cPanel → MySQL Databases:
   - Create a new database (e.g. yourname_license)
   - Create a new user with a strong password
   - Add the user to the database with ALL PRIVILEGES
   - Note down: DB name, DB user, DB password

3) config.php EDIT KORO
   Open config.php in a text editor and change:
     DB_NAME         → your database name
     DB_USER         → your database user
     DB_PASS         → your database password
     ADMIN_PASSWORD  → strong password for admin panel
     MAX_DEVICES_PER_KEY → default device limit per key

4) FILE UPLOAD KORO
   cPanel File Manager → subdomain folder → upload all files
   (config.php, install.php, validate.php, admin.php, .htaccess)

5) INSTALL RUN KORO
   Browser open: https://license.yourdomain.com/install.php
   "Tables created successfully" dekhale → DELETE install.php file

6) ADMIN PANEL
   https://license.yourdomain.com/admin.php
   Login with your ADMIN_PASSWORD → Generate keys

7) EXTENSION E ENDPOINT SET KORO
   Extension er license.js file open koro, top e change koro:
     export const LICENSE_API_URL = "https://license.yourdomain.com";
   (Note: /validate part extension code e already ache, sudu base URL dao)

   Then repack extension folder and load in Chrome.

========================================
HOSTING REQUIREMENTS:
========================================
- PHP 7.4+ (PHP 8.x recommended)
- MySQL / MariaDB
- PDO extension (default on most cPanel hosts)
- HTTPS on the subdomain (Let's Encrypt in cPanel)

========================================
API ENDPOINT (for reference):
========================================
POST https://license.yourdomain.com/validate.php
Content-Type: application/json
Body: { "key": "XXXX-XXXX-XXXX-XXXX", "deviceId": "dev_uuid" }

Response (success):
{ "valid": true, "plan": "pro", "expiresAt": "2027-01-01T00:00:00+00:00" }

Response (fail):
{ "valid": false, "error": "Invalid license key" }
