BimoSora

Untitled

Jun 20th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <table class="unstriped table-server-margin">
  2. <thead>
  3. <tr>
  4. <th>Interface</th>
  5. <th>Download</th>
  6. <th>Upload</th>
  7. </tr>
  8. </thead>
  9. <?php
  10. require_once("../../../../connection/connection.php");
  11. require_once("../../../../connection/routeros_api.class.php");
  12. $tw_status_vpn3 = $db->prepare("SELECT * FROM tw_status_vpn WHERE status_negara = :status_negara");
  13. $tw_status_vpn3->bindParam(":status_negara", $_GET['id2']);
  14. $tw_status_vpn3->execute();
  15. echo '<div class="text-center"><h5>';
  16. if($tw_status_vpn3->rowCount() == 0){
  17. header("Location: ../../../../id/error");
  18. }else{
  19. $data2 = $tw_status_vpn3->fetch();
  20. }
  21. echo '</h5></div>';
  22.  
  23. $API = new RouterosAPI();
  24.  
  25. $API->debug = false;
  26.  
  27. if ($API->connect($data2['status_ip'], $data2['status_login'], $data2['status_password'])) {
  28.  
  29. $API->write('/interface/print');
  30. $ARRAY2 = $API->read();
  31.  
  32. foreach ($ARRAY2 as $data3) {
  33. $interface = $data3['name'];
  34.  
  35. $monitor = $API->comm("/interface/monitor-traffic", array(
  36. "interface" => $interface,
  37. "once" => "",
  38. ));
  39.  
  40. $frx = number_format($monitor[0]['tx-bits-per-second']/1048576,1,",",".");
  41. $frx2 = number_format($monitor[0]['rx-bits-per-second']/1048576,1,",",".");
  42.  
  43. }
  44.  
  45. $API->disconnect();
  46.  
  47. } else {
  48.  
  49. }
  50. ?>
  51. <?php
  52. echo "<tbody>";
  53. foreach ($ARRAY2 as $data4) {
  54. echo "<tr>";
  55. echo "<td class='text-left'>";
  56. $interface2 = $data4['name'];
  57. echo $interface2;
  58. echo "</td>";
  59. echo "<td class='text-left'>";
  60. print_r ($frx);
  61. echo " Mbps";
  62. echo "</td>";
  63. echo "<td class='text-left'>";
  64. print_r ($frx2);
  65. echo " Mbps";
  66. echo "</td>";
  67. echo "</tr>";
  68. }
  69. ?>
  70. </tbody>
  71. </table>
Add Comment
Please, Sign In to add comment