"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "examples/vnstat-json.php" between
vnstat-2.7.tar.gz and vnstat-2.8.tar.gz

About: vnStat is a console-based network traffic monitor (using the /proc filesystem).

vnstat-json.php  (vnstat-2.7):vnstat-json.php  (vnstat-2.8)
<?php <?php
/* vnstat-json.php -- example php for vnStat json output */ /* vnstat-json.php -- example php for vnStat json output */
/* copyright (c) 2015 Teemu Toivola <tst at iki dot fi> */ /* copyright (c) 2015-2021 Teemu Toivola <tst at iki dot fi> */
/* released under the GNU General Public License */ /* released under the GNU General Public License */
/* list of available interfaces, edit as necessary */
$interfaces = array("eth0", "eth1", "ethX");
/* location of vnstat binary */ /* location of vnstat binary */
$vnstat_cmd = "/usr/bin/vnstat"; $vnstat_cmd = "/usr/bin/vnstat";
/* individually accessible interfaces with ?interface=N */
/* for static list, uncomment first line below, update the list and comment out
second line */
//$interfaces = array("eth0", "eth1");
$interfaces = explode("\n", trim(shell_exec("$vnstat_cmd --dbiflist 1")));
/* no editing should be needed below this line */ /* no editing should be needed below this line */
$iface = ""; $iface = "";
$getiface = ""; $getiface = "";
if (isset($_GET['interface']) && ctype_digit($_GET['interface'])) { if (isset($_GET['interface']) && ctype_digit($_GET['interface'])) {
$getiface = $_GET['interface']; $getiface = $_GET['interface'];
} }
if (strlen($getiface) > 0 && $getiface >= 0 && $getiface < count($interfaces)) { if (strlen($getiface) > 0 && $getiface >= 0 && $getiface < count($interfaces)) {
$iface = " -i ".$interfaces[$getiface]; $iface = " -i ".$interfaces[$getiface];
 End of changes. 3 change blocks. 
4 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)