Relationship between uploaded HTML and index.php in Captive portal.
-
Hi all,
We use the Captive portal for free guest wifi, and I've been asked to add a short survey to the connect page.
Adding a form to the HTML is not a problem, but in looking at the existing index.php page (to add code to save the index.html form data), it's not clear what the relationship between the two are once the html is uploaded.
Any insights on how it works. I see the form data being displayed but the "Connect" action no longer is responded to by php.
Any insights would be appreciated.
-
@Intone said in Relationship between uploaded HTML and index.php in Captive portal.:
the relationship
When the device hits the captive portal's web server at @IP-Portal:800x the index.php is used.
"index.php" because : see the nginx main configuration file - one for http and one for https.If the user isn't already logged in, the index.php doesn't do match and falls trough the index.php up until this point.
The function portal_reply_page is called with $type set "login" so the main 'html' login page is sourced (line 1835), this is your uploaded html file, variables are put in place, stuff like #PORTAL_ZONE#, and then the magic happens at line 1868.
echo $htmltext;
and done.
When you hit "Connect", now your 'posting', the same index file is used, and you reach the most common point where user and password entries are tested, and if ok, access is granted.
short survey : You can use php in your self made 'html' page. edit : go for the easy mode : create a link text (URL) that links to another web page that you upload into pfSense. You will have to write some back end code (script) to handle the user input.
Get a copy of the default build in login page (you can see it here) for an example.