• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Relationship between uploaded HTML and index.php in Captive portal.

Scheduled Pinned Locked Moved Captive Portal
2 Posts 2 Posters 421 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I
    Intone
    last edited by Sep 17, 2024, 4:28 PM

    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.

    G 1 Reply Last reply Sep 19, 2024, 10:02 AM Reply Quote 0
    • G
      Gertjan @Intone
      last edited by Gertjan Sep 19, 2024, 10:14 AM Sep 19, 2024, 10:02 AM

      @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.

      9c814fc8-8d56-4bad-acdb-fc7a62a19dc5-image.png

      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.

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      1 out of 2
      • First post
        1/2
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
        This community forum collects and processes your personal information.
        consent.not_received