FreeWifi PHP Portal for ubiquiti controller
FreeWifi PHP Captive Portal, useful for builds coffee or restaurants free hotspots without pay external cloud services. Works with Ubiquiti Unifi controller v4.X and v5.X
NB: This project has been deprecated. It's works anyway, but I suggest you to take a look to a modern springboot reimplementation with embedded webserver and administration panel: jEspresso Guest Portal
Prepare your system installing the unifi controller, a web server (Nginx/Apache) with PHP/PDO CURL and a DBMS (Mysql or Sqlite3);
Put guest/ directory into webserver root (like /var/www/html) and change permissions to access www-data webserver user;
To increase security, move guest/s/default/db/hotspot.sqlite and hotspot.sql files to another path (like /var) inaccessible from web, but accessible from php;
Edit guest/s/default/config.inc.php Unifi Controller options, database settings and $GLOBALS['sessionLogging'] with random string.
If you use mysql, import hotspot.sql file into database (you can use PhpMyAdmin). If you prefer sqlite, set $GLOBALS['dbms']='sqlite' and $GLOBALS['sqliteFile'] to hotspot.sqlite file. For backend you can use sqliteweb (https://github.com/coleifer/sqlite-web).
Log in in Unifi Controller and set External Hotspot (from Guest Policies) to redirect to custom captive ip address.
All access will be logged into access_logs database table (set $GLOBALS['logAccessEnabled']) to false for disabling logging)
Set $GLOBALS['GuestMailAccess'] to true to enable guest authentication by email address (useful for signing up to newsletter)
Set $GLOBALS['showHomeRegistered'] to false to hide disable registered accounts (guest only)
Enjoy
This tool is released under MIT License
This Captive Portal is based on
Springboot / Angular reimplementation. Work in progress.
Emanuele Paiano - nixw0rm [at] gmail [dot] com
If you like this project, consider a little donation, so I can buy new hardware for testing and development. At least you can offer me a coffee.. :)