RASTY WebPanel — Clickadu edition
=================================

Install
1. Upload the whole folder to a PHP 7.4+ host (cURL enabled), e.g. /public_html/clickadu/
2. Open https://yourdomain.com/clickadu/admin/ and log in (default admin / ismail22).
3. CHANGE THE PASSWORD AND SECRET in config.php before going live:
     php -r "echo password_hash('NEWPASS', PASSWORD_DEFAULT);"   -> 'password_hash'
     any long random string                                      -> 'secret'
4. Paste your Clickadu API token in the "API Token" box, add campaign IDs with run/pause
   minutes, and press Start.

What it does (same features as the PropellerAds panel)
- Per-campaign run/pause cycles, working-hours table, SmartyAds global rotation
- Auto budget top-up, email / Telegram / push notifications, logs, balance + stats bar

Clickadu API mapping (FAQ docs + swagger)
- Campaign details / status : GET  /api/v2/campaigns/{id}/      (status may be a number or a word)
    numbers: 1 draft, 2 moderation, 3 rejected, 5 testing, 6 working, 7 paused, 8 stopped
- Start / stop              : POST /api/v2/campaign/{id}/change_status/{start|stop}/  (falls back to 6 / 8)
- Budget top-up             : GET the campaign, raise totalAmount, PUT the whole object back
- Statistics                : GET  /v1.0/api/client/statistics/ (dateFrom, dateTill, groupBy)
- Balance                   : GET  /api/v2/client/balance/
- The docs (adv.clickadu.com/api) and the swagger (ssp.clickadu.com) disagree on host/prefix and the
  auth header format, so clickadu_proxy.php probes the options in config.php ('api_roots',
  'auth_styles') on the first call and remembers the one that works. The log shows
  "Clickadu API route in use: ..." and, on errors, every URL it tried with its HTTP status.

Status handling
- draft / moderation / rejected campaigns are skipped and removed from the scheduler.
- If the status cannot be read, the campaign is skipped for that cycle only (not disabled).
- Clickadu has no "completed" status. Budget exhaustion is detected when the campaign is
  stopped/paused and its spend (statistics) >= its total budget.

Security changes vs. the original
- Signed HMAC login cookie (HttpOnly, SameSite) instead of a fake "active" cookie
- Hashed password; failed logins are delayed
- All API calls go through clickadu_proxy.php, which requires login and only allows the
  5 endpoints above; send_email.php also requires login
