Karvi Partner Contract — Server Upload Guide
============================================

Requirements
------------
- PHP 8.0 or newer (with GD extension for signatures)
- Apache with mod_rewrite enabled (or nginx equivalent)
- HTTPS strongly recommended (required for browser location on contract links)

Upload
------
1. Upload and extract the zip into your web root or subfolder.
2. Ensure these folders are writable by PHP:
   - uploads/contracts
   - uploads/signatures
   - uploads/signed
   - database
3. Document root must point to the folder containing index.php.

Apache subfolder example
------------------------
If the app lives at https://example.com/karvi/ then set in .htaccess:
  RewriteBase /karvi/

PDF downloads
-------------
Contract and signed PDFs are served via index.php (not direct uploads/ access).
The root .htaccess routes /uploads/contracts/ and /uploads/signed/ automatically.

URL configuration
-----------------
config/config.php → base_url
- Leave empty (default): auto-detects from your live domain + HTTPS.
- Set manually only if links are wrong, e.g.:
  'base_url' => 'https://yourdomain.com',

Admin login (change after first login)
--------------------------------------
- URL: /admin/login
- Default user: admin
- Default password: 123456
Update admin_password in config/config.php before going live.

External API (optional)
-----------------------
Local JSON mode works out of the box (database/data.json).
To use a remote API, edit config/api.php with your real API base URL.

Local dev (optional)
--------------------
php -S localhost:8082 router.php

Notes
-----
- Contract links use relative paths in the UI; full URLs are built from base_url.
- PDFs are generated by PHP (FPDF) — no external PDF service needed.
- uploads/ is blocked from direct access; PDFs are served via the app router.
