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

    Need little PHP help

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 1.2k 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.
    • M
      maverick_slo
      last edited by

      Hi all!

      I`ve created new file (modified iface_status) that shows PPPoE uptime only…

      Here it is:

      require_once("/usr/local/www/guiconfig.inc");
      ?>
              $i = 0;
              $ifdescrs = get_configured_interface_with_descr(false, true);
              foreach ($ifdescrs as $ifdescr => $ifname):
              $ifinfo = get_interface_info($ifdescr);
      ?>
      
                      echo $ifinfo['ppp_uptime'];
              ?>
      
      

      Can someone please help me create this without foreach loop please?
      Also, now value is like 111:05:51 (H:M:S), how can I convert this to D:H:M:S like 4 days, 15 hours, 5 minutes, 51 seconds

      Thanks all!

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

        Hi, Best regards

        I try to understand your code,

        in this lines

        foreach ($ifdescrs as $ifdescr => $ifname):
                $ifinfo = get_interface_info($ifdescr);

        i think that maybe you have one error, because you don't use the real value ( $ifname), you use, the  key ($ifdescr)
        …
                foreach ($ifdescrs as $ifdescr => $ifname):
                $ifinfo = get_interface_info($ifname);
        ...

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