Advertisement
Guest User

Untitled

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