NLIND Server v5 — JSON CRUD Ready
=================================

Overview
--------
Lightweight PHP + JSON endpoints for NLIND Admin / User apps.
- No database required (uses `quotes.json`)
- Category images saved under `uploads/categories/`
- Centralized `server_version.json` holds `base_url` and `version`
- Mutating endpoints require API_KEY (set in config.php)
- User App auto-syncs domain if it reads `server_version.json` on launch

Endpoints
---------
GET  /get_categories.php
    -> { "categories": [ {"name":"Motivation","image":"https://.../uploads/categories/xxx.jpg"}, ... ] }

POST /add_category.php   (multipart/form-data)
    fields: name, image, api_key
    -> { "success": true, "image_url": "https://.../uploads/categories/xxx.jpg" }

POST /delete_category.php
    fields: name, delete_image (0/1 optional), api_key
    -> { "success": true }

GET  /get_quotes.php?category=Motivation
    -> { "category":"Motivation", "quotes":[ "q1", "q2" ] }

POST /add_quote.php
    JSON or x-www-form-urlencoded
    fields: category, text, api_key
    -> { "success": true }

POST /delete_quote.php
    fields: category, index (or text), api_key
    -> { "success": true }

Server Version (Domain Sync)
----------------------------
- File: server_version.json
- Admin App: POST /update_server.php with api_key and optional base_url to update.
- User App: Read server_version.json at launch to update its Base URL automatically.

Files
-----
- config.php
- get_categories.php
- add_category.php
- delete_category.php
- get_quotes.php
- add_quote.php
- delete_quote.php
- update_server.php
- quotes.json
- server_version.json
- uploads/categories/.gitkeep

Security Notes
--------------
- Change API_KEY in config.php before deploying.
- Keep `uploads/` writeable (0755 directory, 0644 files).
- Consider restricting `add/delete` endpoints via IP/HTTPS only.
- Take periodic backups of quotes.json (e.g., cron copy).

Setup
-----
1) Upload all files to your server directory (e.g., /sell/premium/).
2) Ensure `/uploads/categories/` is writable.
3) Edit `config.php` -> set your API_KEY.
4) Test:
   - GET get_categories.php (should return empty list initially).
   - POST add_category.php with name + image + api_key.
5) In your Admin App Settings, set Base URL to this folder's URL.
6) Optional: call update_server.php with new base_url + api_key to change domain/base URL.

