Skip to content

Latest commit

 

History

History
executable file
·
80 lines (50 loc) · 2.08 KB

File metadata and controls

executable file
·
80 lines (50 loc) · 2.08 KB

UniFi Guest Email Capture

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.

Live app

This is a local-only demo (meant to be hosted on-site).

Running locally

Things you need

  • XAMPP (Apache + PHP)
  • UniFi Controller access (credentials + site ID)
  • Art of WiFi's UniFi API client (included in htdocs/guest/s/default/unifi-api/)

The easy way

Place the htdocs folder inside your XAMPP install and start Apache.

# Example path on Windows:
# C:\xampp\htdocs\guest

Then open the captive portal URL (with UniFi parameters), for example:

http://localhost/guest/s/default/?id=<mac>&ap=<ap_mac>&ssid=S1%20Guest

The harder way

If you want to host it elsewhere, make sure the web server serves the htdocs/guest directory and PHP is enabled.

Configure the UniFi controller

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.

CSV output

Submissions are appended to CSV files in the same directory as auth.php:

  • store1.csv
  • store2.csv
  • defaultstore.csv

Each row includes: name, email, marketing opt‑in value.

Architecture

- Browser (captive portal form)
- PHP (auth + UniFi API client)
- UniFi Controller (guest authorization)
- CSV files (email capture)

Features

  • Guest authorization via UniFi Controller API
  • Email capture with opt‑in checkbox
  • Multi-location support via SSID routing
  • CSV logging per store

Notes

  • The portal expects UniFi captive portal query params (id, ap, ssid).
  • Add new stores by expanding the SSID mapping blocks in index.php and auth.php.
  • Test thoroughly in your environment before using in production.

Enjoy!