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

    Voucher remaining time

    Scheduled Pinned Locked Moved Captive Portal
    11 Posts 6 Posters 2.1k 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.
    • R
      rsbernardes
      last edited by

      Hi Ericson,

      not advise release management access to the pfsense users, but you can create an account with limited privilege just to check the status of vouhcer. I believe this would be an alternative.

      Rogério
      Campinas, São Paulo
      Brazil.

      1 Reply Last reply Reply Quote 0
      • J
        jhochwald
        last edited by

        @Ericson:

        a client or user can check the remaining minutes of his voucher?

        This is a snippet that works fine for me:

                  	$var1=$pagetitle;
        	$var2=$seconds;
        
                    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;
                    }
                 ?>
                  		 if (isset($remaining_time)) {
                 	echo 'Verbleibende Online Zeit: ' . secondsToWords($remaining_time) . '';
        		 }
                  ?>
        

        The if is useful to prevent the Display for regular (non voucher users)! without hacking pfSense the system doesn't return it for non voucher users.

        P.S.: I included this snippet in my Logout page contents and it works fine.

        Regards

        /JH

        1 Reply Last reply Reply Quote 0
        • J
          jpt.ericsongmail.com
          last edited by

          thanks for the info guys. :)

          1 Reply Last reply Reply Quote 0
          • DerelictD
            Derelict LAYER 8 Netgate
            last edited by

            You could also look at the code involved in pfSense's test Voucher page.  It's probably fairly easy to include that in a login or logout page.  Or a custom page you upload into the CP.

            Chattanooga, Tennessee, USA
            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
            Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

              @Derelict

              Hi, I use the pfsense version 2.3.5 for i386, but it doesn't show me the remaining time of the vouchers, and the clients ask me for the remaining time, has anyone been able to ?, help.

              1 Reply Last reply Reply Quote 0
              • DerelictD
                Derelict LAYER 8 Netgate
                last edited by

                First step: Upgrade. If you need to, get 64-bit hardware.

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

                  Okay, yes, I updated it to 2.4.4-p3, 1 hour ago I installed it, but I can't show the status of the remaining time to my clients, how I manage to do it, and that it operates, I have read other guides, but none of them works. I hope you can help me with an example php or html code.

                  1 Reply Last reply Reply Quote 0
                  • GertjanG
                    Gertjan
                    last edited by

                    When you create a voucher that lasts 1 hour or 60 minutes, and the guy that uses this voucher connects at 10h30 - then he will know it ends at 11h30. No big mathematical background needed to find the "11h30" here.
                    Or I didn't understood the question.

                    Btw : the counters start ticking when they - the voucher users - connect. The fact that they move away from the network doesn't matter. The counter keeps ticking.

                    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
                    • W
                      walter_leon
                      last edited by

                      @Gertjan Could you publish your php code that you managed to work ??, Thanks..
                      Thank you

                      GertjanG 1 Reply Last reply Reply Quote 0
                      • GertjanG
                        Gertjan @walter_leon
                        last edited by

                        @walter_leon said in Voucher remaining time:

                        @Gertjan Could you publish your php code that you managed to work ??, Thanks..

                        What code to make work what ?

                        If it's he remaining voucher time, I never wrote any code for that.
                        I rarely use vouchers and if I use them, it's marked on the voucher : "this voucher works for x hours". I'll leave it up to the user to "calculate" the end time.
                        Better yet ; I probably wouldn't hand over a voucher to some one (a kid ?) who couldn't do that ....

                        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
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.