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

    My CP doesn't honor PORTAL_REDIRURL?

    Scheduled Pinned Locked Moved Captive Portal
    2 Posts 2 Posters 1.9k 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.
    • D
      docwho76
      last edited by

      Have had this problem for a while but havent really had the opportunity to work on it much. Problem in a nutshell is this, when users go to my captive portal they hit a redirect that takes them to a custom PHP login page. If a user tries to go to "www.google.com" the first time and they then login with their user credentials, after hitting the submit button the user is still at the login page but now is fully authenticated. So what I want to happen is:

      1. User tries to go to www.yyy.com
      2. pfSense Captive Portal .html page loads meta refresh to .php login page
      3. User enters in credentials to page and hits submit button
      4. User is then redirected to www.yyy.com and can browser normally.

      Attached below are the code for the index.html and the captiveportal-xxxxx.php pages I am using. Can someone point out what I'm doing wrong here? All of the code in the .php is so I can display a MAC address alongside the IP address for diagnostic reasons. Thanks!

      index.html
      –--------

      
      <title>LocationConnect Captive Portal Redirect</title>
      
      Loading...
      
      

      captiveportal-xxxxx.php
      –---------------------

      
              "HTML-Kit Tools HTML Tidy plugin">
      
              "Content-Type">
          <title><br />      CLIENTNAME Login<br /></title> 
      
            function returnmacAddress() {
          // Get the arp executable path
          $location = `which arp`;
          $location = rtrim($location);
      
          // Execute the arp command and store the output in $arpTable
          $arpTable = `$location -a`;
      
          // Split the output so every line is an entry of the $arpSplitted array
          $arpSplitted = split("\n",$arpTable);
      
          // Get the remote ip address (the ip address of the client, the browser)
          $remoteIp = $GLOBALS['REMOTE_ADDR'];
          $remoteIp = str_replace(".", "\\.", $remoteIp);
      
          // Cycle the array to find the match with the remote ip address
          foreach ($arpSplitted as $value) {
                  // Split every arp line, this is done in case the format of the arp
                  // command output is a bit different than expected
                  $valueSplitted = split(" ",$value);
                  foreach ($valueSplitted as $spLine) {
                          if (preg_match("/$remoteIp/",$spLine)) {
                          $ipFound = true;
                          }
                          // The ip address has been found, now rescan all the string
                          // to get the mac address
                          if ($ipFound) {
                                  // Rescan all the string, in case the mac address, in the string
                                  // returned by arp, comes before the ip address
                                  // (you know, Murphy's laws)
                                  reset($valueSplitted);
                                  foreach ($valueSplitted as $spLine) {
                                          if (preg_match("/[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f]/i",$spLine)) {
                                                  return $spLine;
                                          }
                                  }
                          }
                          $ipFound = false;
                  }
          }
          return false;
          }
          ?>
      
      <center style="font-family: Helvetica,Arial,sans-serif; font-size: 100%;">
      
            ![Logo](captiveportal-showstoppers-logo.gif)
      
      <form method="post" action="$PORTAL_ACTION$">
      
      | 
      
      <center>
                        **Welcome to CLIENTNAME.**</center>
      
      <center>
                        Please enter your logon and
                        password.
                      </center>
      
       If you have any questions, please ask one of our
                      friendly on-site technicians for assistance.
                     |
      | 
      
                     | 
      
                     | 
      
                     |
      | 
                      Username:
                     | 
      
                     | 
      
                     |
      | 
                      Password:
                     | 
      
                     | 
      
                     |
      
            </form>
      
          </center>
      
           -
      
      
      1 Reply Last reply Reply Quote 0
      • E
        EOC2611P
        last edited by

        A bit late i know, i was browsing to find some answers too, so just in case someone have this problem too, go to Services>>Captive Portal and enter the website you want the person to be redirected to in the field named "After authentication Redirection URL", don't forget to put the "http://" on front of the "www" or it won't work…. :)

        {ie:  http://www.yyy.com}

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.