Sample captive login page with pre-auth
-
i have created a HTML (with simple css and js) to have a working captive portal. Now i must add the code to have the CP redirect users to a page to force the users seeing it before getting to the login screen to use Internet. I have added the code php code into my HTML file as instructed in the documentation. My portal.html file is now like this:
<title>Welcome to Bonita</title> require("globals.inc"); $request_uri = urldecode(str_replace("/index.php?redirurl=", "", $_SERVER["REQUEST_URI"])); $portal_redirurl = urldecode("$PORTAL_REDIRURL$"); if(!stristr(urldecode("$PORTAL_REDIRURL$"), $request_uri)) { Header("Location: $PORTAL_REDIRURL$"); exit; } ?> # Welcome to Bonita <form method="post" action="$PORTAL_ACTION$"> ### Username: ### Password: </form> Error: Try again?
However it is showing errors .. i don't know what's wrong here…
can someone pls shed a light here ?
thank you -
However it is showing errors .. i don't know what's wrong here…
Unless I know what errors you're getting, I'm sure nobody else will know what's wrong here either.
I'm also not sure I understand what you're trying to accomplish by directing people to a page OTHER than the CP page BEFORE you load the CP. How is the page you're redirecting people to going to know to send you on to the CP page from there?
-
@pgguy : you did took in consideration https://forum.pfsense.org/index.php?topic=34148.msg181641#msg181641 and this one : https://doc.pfsense.org/index.php/Captive_Portal_Pre-authentication_Redirect
I saw you file, but I don't know what to do with it. Check it , How ?
Did you put it where ? pfSense ? Another server ?
How did you set up the Captive Portal ?You have to be far more specific : we don't know nothing about your practically unique setup ….
-
thank you for your replies.
First, I have a marketing page which i change from time to time depends on the promotion we are running, and i need all customers to see that before they can start using our free Internet. So, I need the Captive portal to redirect them to that page as soon as they select to use our Wifi. At the end of that page, there is a link says "Continue to Internet", they can click on that and get to the Captive Portal login.
that's the idea.
Now i stuck at the part that redirects them as soon as they select the Wifi. Normally, when they select our wifi, they will be presented with the captive portal login, right ? i want them to see our marketing page first, that's the idea of Pfsense Pre-auth redirection, right ?
the file i posted above is my index.html file I uploaded to Pfsense server as my Captive portal page.
When i integrated the code for Pre-auth into my captive portal html as instructed on the Pfsense documentation page, this is what i got :Fatal error: Cannot redeclare platform_booting() (previously declared in /etc/inc/globals.inc:223) in /etc/inc/globals.inc on line 223 Call Stack: 0.0000 227744 1. {main}() /usr/local/captiveportal/index.php:0 0.0060 1404112 2. portal_reply_page() /usr/local/captiveportal/index.php:262 0.0060 1404360 3. get_include_contents() /etc/inc/captiveportal.inc:1943 0.0060 1422168 4. include('/var/etc/captiveportal_bonitahv.html') /etc/inc/pfsense-utils.inc:2364 PHP ERROR: Type: 1, File: /etc/inc/globals.inc, Line: 223, Message: Cannot redeclare platform_booting() (previously declared in /etc/inc/globals.inc:223)
if anyone already has a working pre-auth file, please share with me. That would be much appreciated. thanks
-
:-[
Anyone having preauth page working so that users are force to see a splash page and then they can click a button on that splash page to continue to the captive portal login? Please share. Thanks a lot.