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

    Is it possible to show the voucher timer as a pop up small window?

    Scheduled Pinned Locked Moved Captive Portal
    23 Posts 9 Posters 9.0k 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.
    • N
      neobauer
      last edited by

      Hi dpa,
      does it mean that we don't have to include the 'captiveportal-vars.php to let this work ?

      You mentioned at the beginning that you don't like pop up windows.
      May I know/see please how you valide the form in the login page ? meaning target windows ?

      And last question, can we see the css file just for testing ?

      Thanks a lot !

      1 Reply Last reply Reply Quote 0
      • G
        GS850L
        last edited by

        Tell me if I have this wrong:

        1. Create a script that echoes the "time_remaining" variable
        2. Create a custom php/html page for the logout that shows the data from step #1 (Is this the code from above?)
        3. Modify captiveportal.inc to disable popup and enable the custom page from step#2

        1 Reply Last reply Reply Quote 0
        • N
          neobauer
          last edited by

          @GS850L:

          1. Create a script that echoes the "time_remaining" variable
          2. Create a custom php/html page for the logout that shows the data from step #1 (Is this the code from above?)

          Are not 1. and 2. the code from above ?

          3. Modify captiveportal.inc to disable popup and enable the custom page from step#2

          How please ?

          A step by step guide will be really very helpful for All. Thanks !
          And sorry for my too many questions. I'm not really experienced with PHP Coding. Thanks for understanding.

          1 Reply Last reply Reply Quote 0
          • G
            GS850L
            last edited by

            I tried running the script but only got a bunch of empty variables showing, along with the little bit of html text.  Uncertain as to what the constant variable php is for…?

            1 Reply Last reply Reply Quote 0
            • D
              dpa
              last edited by

              Hi guys,

              I'm sorry you're having a hard time figuring this out. And I can't easily remember the step by step procedure how I did it as I already moved to Unifi.

              But I guess you can try these steps as a start:

              1. Enable logout popup window.
              2. Locate the default script for the logout and echo this variable $remaining_time anywhere in the script.

              See if that outputs the remaining time for that voucher. Post back the result here.

              Kind regards,

              1 Reply Last reply Reply Quote 0
              • G
                GS850L
                last edited by

                I seem to have got it to work for the most part. I commented out the top part about /include_once('captiveportal-vars.php');/
                Then I added a little html code to make the time remaining large (just for testing) and then uploaded to the captive portal "Logout page contents" at the very bottom.

                Still trying to get the "click to continue" to go to the url we want…

                2014-09-10_2132.png
                2014-09-10_2132.png_thumb

                1 Reply Last reply Reply Quote 0
                • R
                  romeomarco09
                  last edited by

                  Thanks dpa! perpectly working!

                  1.enable logout popup window on cp
                  2.create php file, name it captiveportal-vars.php and paste this code inside
                           ```

                  $var1=$pagetitle;
                              $var2=$seconds;

                  ?>

                  then upload it on your cp file manager.
                  3.create a html or php file again and name it what ever you want and paste this code inside.
                  
                  

                  include_once('captiveportal-vars.php');
                  ?>

                  ".$pagetitle."");?>

                  Login Successful! Thank you for using our service.
                                      function secondsToWords($seconds)
                              {
                                  $ret = "";

                  /*** get the days **/
                                  $days = intval(intval($seconds) / (3600
                  24));
                                  if($days> 0)
                                  {
                                      $ret .= "$days days ";
                                  }

                  /*** get the hours ***/
                                  $hours = (intval($seconds) / 3600) % 24;
                                  if($hours > 0)
                                  {
                                      $ret .= "$hours hours ";
                                  }

                  /*** get the minutes ***/
                                  $minutes = (intval($seconds) / 60) % 60;
                                  if($minutes > 0)
                                  {
                                      $ret .= "$minutes minutes ";
                                  }

                  /*** get the seconds ***/
                                  $seconds = intval($seconds) % 60;
                                  if ($seconds > 0) {
                                      $ret .= "$seconds seconds";
                                  }

                  return $ret;
                              }       
                          ?>

                  Remaining Time:

                  Click to continue

                  
                  then save and upload it on Logout page contents (buttom part of cp).
                  
                  again thank you dpa!
                  1 Reply Last reply Reply Quote 0
                  • R
                    romeomarco09
                    last edited by

                    @GS850L:

                    I seem to have got it to work for the most part. I commented out the top part about /include_once('captiveportal-vars.php');/
                    Then I added a little html code to make the time remaining large (just for testing) and then uploaded to the captive portal "Logout page contents" at the very bottom.

                    Still trying to get the "click to continue" to go to the url we want…

                    try this instead of href="$redirurl"

                    [Click to continue](<?=$my_redirurl;?>)
                    
                    1 Reply Last reply Reply Quote 0
                    • D
                      dpa
                      last edited by

                      Hi!

                      Glad it worked. But to clarify, this code below can be omitted and is not important.

                      include_once('captiveportal-vars.php');
                      ?>

                      The only part of this script that the above code is of use is this line:

                      ".$pagetitle."");?>

                      which can be replaced with a basic html:

                      <title>Your own page title</title>

                      And yes probably newer versions of pf uses $my_redirurl instead of $redirurl

                      Kind regards,

                      1 Reply Last reply Reply Quote 0
                      • N
                        neobauer
                        last edited by

                        Hi All,
                        Thanks for those updates. I will try it also during the day and provide feedback.
                        May I know which version of Pfsense you are using ? I'm on 2.1.5.

                        1 Reply Last reply Reply Quote 0
                        • R
                          romeomarco09
                          last edited by

                          @dpa:

                          Hi!

                          Glad it worked. But to clarify, this code below can be omitted and is not important.

                          include_once('captiveportal-vars.php');
                          ?>

                          The only part of this script that the above code is of use is this line:

                          ".$pagetitle."");?>

                          which can be replaced with a basic html:

                          <title>Your own page title</title>

                          And yes probably newer versions of pf uses $my_redirurl instead of $redirurl

                          Kind regards,

                          sir can i request? i want the remaining time showing countdown on realtime.
                          i know you can do that. i am not good in js so can you please do this for us?
                          thank you very much!

                          @neobauer im also running v2.1.5

                          W 1 Reply Last reply Reply Quote 0
                          • T
                            tsudenoconsigliere
                            last edited by

                            how about displaying the time remaining when using the Max-Daily-Session function? can anyone help me here? :\

                            1 Reply Last reply Reply Quote 0
                            • W
                              walter_leon @romeomarco09
                              last edited by

                              @romeomarco09
                              you could publish the php or the files you used for this case.

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