Capture additional information on captive portal page and send it elsewhere

  • I am using captive portal without any authentication, just need to show T&Cs to user's before they gain internet access.

    I have a php form which I would like to include on the captive portal page.
    My form asks for Name, Email Address, DOB, Marketing agreement and Gender and post's the data to a standard MySQL DB (hosted elsewhere). All very simple stuff. The information captured is for our own use, marketing etc and not tied to the portal.

    I cannot figure out how I can have this php form combine with the Captive Portal "Accept" button. My form requires me to do a:

    <form action="index.php" method="post"> which is obviously the same "POST" requirement as the Captive Portal form. 
    Essentially I want one accept button that runs the first part of my php to post the fields into my SQL DB, and then runs the relevant captive portal action to allow the user access. 
    Is it possible to write something within my php code that will carry out the captive form post function? 
    So I could code my page in my usual way, including any posts to the same page to verify data entered etc, and then once my verification "if" loops have finished, the php carries on to post the relevant code to the pfsense box and allow the user access?
    I assume it would need to pick up the $PORTAL_ACTION$, $PORTAL_REDIRURL$ and $PORTAL_ZONE$ values which are on the basic portal page.
    I would guess another way of looking at it…. Is there some PHP code that will automatically accept somebody through the portal which them clicking anything? If I had this code I could place it at the end of my script and have it do its job of allowing the user access to the internet. 

  • You have to do this in two steps.
    First step, you make your own submission, which reloads the same page, and launches the php code where you store your info.
    Then, once this is done, you just show the CP form and have javascript autoclick on the submit button.
    See my captive portal code in thread, my code does this more or less with the Login function.

Log in to reply