# IPTV Player backend

Shared-hosting PHP backend for trial activation, Stripe payment and per-device playlists.

## Install

1. Create a MySQL database.
2. Import `schema.sql`.
3. Edit `config.php`:
   - database username/password
   - `app.site_url`, for example `https://your-domain.com/backend`
   - `admin.username` and `admin.password`
   - Stripe secret key and webhook secret
   - price and paid days
4. Upload the `backend` folder to your hosting.
5. In Stripe Dashboard, add webhook URL:
   `https://your-domain.com/backend/stripe_webhook.php`
   and enable the `checkout.session.completed` event.
6. In `js/app.js`, set:
   `APP_SERVER_URL = "https://your-domain.com/backend";`

## App flow

- First launch registers the device MAC and starts a 7-day trial.
- `List Playlists` can save M3U or Xtream details from the app.
- The website can save the same playlist after login with MAC.
- After trial expiry the app blocks loading the IPTV playlist until Stripe payment activates the MAC.
- Admin panel is available at `https://your-domain.com/backend/admin.php`.
