# QR Attendance SaaS v1.0 (core)

## Features
- Multi-tenant (Companies)
- Company Admin panel: Locations, Spots (QR), Employees (PIN), Reports (CSV)
- Public check page: /s/{token} -> PIN -> auto IN/OUT
- Cooldown 60 seconds between actions

## Requirements
- PHP 8.0+
- MySQL/MariaDB
- Apache with mod_rewrite (or adapt to Nginx)
- Composer (for QR PNG generation)

## Install (quick)
1) Create DB + import schema:
   - Import: `db/schema.sql`
2) Set DB credentials in: `app/config.php`
3) In project root:
   - `composer install`
4) Point your virtual host document root to: `/public`
5) Create SUPER once:
   - Open: `/setup.php?key=3cd908667f03e8a88d814c59bd940c44`
   - Create your SUPER user
   - Then delete `public/setup.php`
6) Login at `/login.php`

## Nginx rewrite (if needed)
```
location ~ ^/s/([A-Fa-f0-9]{32})$ {
  rewrite ^/s/([A-Fa-f0-9]{32})$ /spot.php?token=$1 last;
}
```

## Notes
- This is v1 core (no selfie).
- For production set `session.secure=true` and use HTTPS.


## Remember this phone (v1.1)
- Added table: employee_devices (import schema.sql to include it)
- On /s/{token} page user can tick 'Remember this phone' so next time only confirm is needed.
- Admin can revoke phones: Employees -> Phones.
