Advertisement
Guest User

Untitled

a guest
Oct 13th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1.  
  2. <?php
  3. ///DB
  4. $Dserv = "localhost";
  5. $Duser = "root";
  6. $Dpass = "cgc_admin";
  7. try {
  8. $conn = new PDO("mysql:host=$Dserv;dbname=planet", $Duser, $Dpass);
  9. // set the PDO error mode to exception
  10. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  11. //echo "DB Connected successfully <br>";
  12. }
  13. catch(PDOException $e)
  14. {
  15. //echo "Connection failed: " . $e->getMessage();
  16. }
  17. $sql = "SELECT * FROM planet";
  18. $stmt = $conn->prepare($sql);
  19. $stmt->execute();
  20. $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
  21.  
  22. ?>
  23. <!DOCTYPE HTML>
  24. <html>
  25. <head>
  26. <title>Planet Errors</title>
  27. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  28. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css">
  29. <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
  30. <script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>
  31. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  32. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  33. <meta charset="UTF-8">
  34. <style>
  35. .error {
  36. background: red;
  37. color: white;
  38. }
  39. </style>
  40.  
  41. </head>
  42. <body>
  43.  
  44.  
  45. <div style="padding: 20px" align="right">
  46. <form action="parser2.php" method="GET">მონაცემთა ბაზის:
  47. <input type="submit" name="act" value="UPDATE" style="margin-right: 10px;">
  48. <input type="submit" name="act" value="CLEAR">
  49. </form>
  50. </div>
  51.  
  52.  
  53. <table border="1" id="myTable" class="table">
  54. <thead>
  55. <tr>
  56. <th>IP</th><th>NUM</th><th>Rx E 1</th><th>Rx D 1</th><th>Tx E 1</th><th>Tx D 1</th>
  57. <th>Rx E 2</th><th>Rx D 2</th><th>Tx E 2</th><th>Tx D 2</th>
  58. <th>Rx E 3</th><th>Rx D 3</th><th>Tx E 3</th><th>Tx D 3</th>
  59. <th>Rx E 4</th><th>Rx D 4</th><th>Tx E 4</th><th>Tx D 4</th>
  60. <th>Rx E W0</th><th>Rx D W0</th><th>Tx E W0</th><th>Tx D W0</th>
  61. <th>Rx E W1</th><th>Rx D W1</th><th>Tx E W1</th><th>Tx D W1</th>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. <?php
  66. foreach($result as $row){
  67.  
  68. $sql7 = "SELECT * FROM planet_log WHERE user=".$row['user'];
  69. $stmt7 = $conn->prepare($sql7);
  70. $stmt7->execute();
  71. $result7 = $stmt7->fetch(PDO::FETCH_ASSOC);
  72.  
  73.  
  74.  
  75. echo "<tr>
  76. <td><a href='http://".$row['ip']."' target='_BLANK'> ".$row['ip']."</a></td>
  77. <td><a href='http://portal.cgc.ge:8080/cgc/maininfo?phone=".$row['user']."' target='_BLANK'> ".$row['user']."</a></td>
  78.  
  79.  
  80. if($row['lan1_rx_err'] != $result7['lan1_rx_err']) {
  81.  
  82.  
  83. <td>".$row['lan1_rx_err']."-".$result7['lan1_rx_err']."</td>
  84.  
  85. <td>".$row['lan1_rx_drop']."</td>
  86. <td>".$row['lan1_tx_drop']."</td>
  87. <td>".$row['lan1_tx_drop']."</td>
  88. <td class='error'>".$row['lan2_rx_err']."</td>
  89. <td>".$row['lan2_rx_drop']."</td>
  90. <td>".$row['lan2_tx_drop']."</td>
  91. <td>".$row['lan2_tx_drop']."</td>
  92. <td>".$row['lan3_rx_err']."</td>
  93. <td>".$row['lan3_rx_drop']."</td>
  94. <td>".$row['lan3_tx_drop']."</td>
  95. <td>".$row['lan3_tx_drop']."</td>
  96. <td>".$row['lan4_rx_err']."</td>
  97. <td>".$row['lan4_rx_drop']."</td>
  98. <td>".$row['lan4_tx_drop']."</td>
  99. <td>".$row['lan4_tx_drop']."</td>
  100. <td>".$row['WAN0_rx_err']."</td>
  101. <td>".$row['WAN0_rx_drop']."</td>
  102. <td>".$row['WAN0_tx_drop']."</td>
  103. <td>".$row['WAN0_tx_drop']."</td>
  104. <td>".$row['WAN1_rx_err']."</td>
  105. <td>".$row['WAN1_rx_drop']."</td>
  106. <td>".$row['WAN1_tx_drop']."</td>
  107. <td>".$row['WAN1_tx_drop']."</td>
  108.  
  109. </tr>";
  110. }
  111. ?>
  112. </tbody>
  113. </table>
  114.  
  115. <script>
  116. $(document).ready(function(){
  117. var table = $('#myTable').DataTable({
  118. "pageLength": 100
  119. });
  120. var rows = table
  121. .rows( function ( idx, data, node ) {
  122. return data.highlight ? true : false;
  123. } )
  124. .nodes();
  125.  
  126. $(rows).addClass('highlight');
  127.  
  128. });
  129.  
  130.  
  131.  
  132. </script>
  133.  
  134. </body>
  135. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement