PHP frontend for the vnStatI utility. Easily get up to date graphs of your network traffic using vnStat.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

8 years ago
  1. <?php
  2. //
  3. // config.php
  4. // vnStatGraphP
  5. //
  6. // Created by Mr. Gecko on 3/28/16.
  7. // Copyright (c) 2016 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
  8. //
  9. //List of interfaces configured for vnStat.
  10. $ifaceList = array("igb0");
  11. //Optional readable title for interfaces.
  12. $ifaceTitles = array("igb0" => "External");
  13. //Graphs to be shown on load of the index.
  14. $defaultGraphs = array(
  15. "vnstati.php?i=igb0&g=vs",
  16. "vnstati.php?i=igb0&g=d"
  17. );
  18. //Location for the binary of vnStatI.
  19. $vnStatIBin = "/usr/local/bin/vnstati";
  20. //Get configuration from parameters.
  21. $iface = isset($_REQUEST['i']) ? $_REQUEST['i'] : "";
  22. if (!in_array($iface, $ifaceList)) {
  23. $iface = $ifaceList[0];
  24. }
  25. $graph = isset($_REQUEST['g']) ? $_REQUEST['g'] : "vs";
  26. switch($graph) {
  27. case "h":
  28. case "d":
  29. case "m":
  30. case "t":
  31. case "s":
  32. case "hs":
  33. case "vs":
  34. break;
  35. default:
  36. $graph = "vs";
  37. }
  38. $noHeader = isset($_REQUEST['nh']) ? (is_string($_REQUEST['nh']) ? empty($_REQUEST['nh']) || preg_match("/^(y|t|on).*/i", $_REQUEST['nh']) : boolval($_REQUEST['nh'])) : false;
  39. $noEdge = isset($_REQUEST['ne']) ? (is_string($_REQUEST['ne']) ? empty($_REQUEST['ne']) || preg_match("/^(y|t|on).*/i", $_REQUEST['ne']) : boolval($_REQUEST['ne'])) : false;
  40. $noLegend = isset($_REQUEST['nl']) ? (is_string($_REQUEST['nl']) ? empty($_REQUEST['nl']) || preg_match("/^(y|t|on).*/i", $_REQUEST['nl']) : boolval($_REQUEST['nl'])) : false;
  41. $rateUnit = isset($_REQUEST['ru']) ? (is_string($_REQUEST['ru']) ? empty($_REQUEST['ru']) || preg_match("/^(y|t|on).*/i", $_REQUEST['ru']) : boolval($_REQUEST['ru'])) : false;
  42. ?>