A multi-location guest WiFi captive portal that captures name/email (opt‑in optional), authorizes guests via the UniFi Controller API, and logs submissions to per‑store CSV files. Built as a lightweight on‑site demo using PHP + XAMPP. Feel free to critique it.
This is a local-only demo (meant to be hosted on-site).
- XAMPP (Apache + PHP)
- UniFi Controller access (credentials + site ID)
- Art of WiFi's UniFi API client (included in
htdocs/guest/s/default/unifi-api/)
Place the htdocs folder inside your XAMPP install and start Apache.
# Example path on Windows:
# C:\xampp\htdocs\guestThen open the captive portal URL (with UniFi parameters), for example:
http://localhost/guest/s/default/?id=<mac>&ap=<ap_mac>&ssid=S1%20Guest
If you want to host it elsewhere, make sure the web server serves the htdocs/guest directory and PHP is enabled.
Update your controller credentials in:
htdocs/guest/s/default/unifi-api/config.php
Per‑SSID controller URL + redirect links are configured in:
htdocs/guest/s/default/auth.php
This is where you map SSIDs (e.g. S1 Guest, S2 Guest) to store names, background images, and controller URLs.
Submissions are appended to CSV files in the same directory as auth.php:
store1.csvstore2.csvdefaultstore.csv
Each row includes: name, email, marketing opt‑in value.
- Browser (captive portal form)
- PHP (auth + UniFi API client)
- UniFi Controller (guest authorization)
- CSV files (email capture)
- Guest authorization via UniFi Controller API
- Email capture with opt‑in checkbox
- Multi-location support via SSID routing
- CSV logging per store
- The portal expects UniFi captive portal query params (
id,ap,ssid). - Add new stores by expanding the SSID mapping blocks in
index.phpandauth.php. - Test thoroughly in your environment before using in production.
Enjoy!