Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ///DB
- $Dserv = "localhost";
- $Duser = "root";
- $Dpass = "cgc_admin";
- try {
- $conn = new PDO("mysql:host=$Dserv;dbname=planet", $Duser, $Dpass);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- //echo "DB Connected successfully <br>";
- } catch (PDOException $e) {
- //echo "Connection failed: " . $e->getMessage();
- }
- $sql = "SELECT * FROM planet";
- $stmt = $conn->prepare($sql);
- $stmt->execute();
- $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
- ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Planet Errors</title>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css">
- <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
- <script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <meta charset="UTF-8">
- <style>
- .error {
- background: red;
- color: white;
- }
- </style>
- </head>
- <body>
- <div style="padding: 20px" align="right">
- <form action="parser2.php" method="GET">მონაცემთა ბაზის:
- <input type="submit" name="act" value="UPDATE" style="margin-right: 10px;">
- <input type="submit" name="act" value="CLEAR">
- </form>
- </div>
- <table border="1" id="myTable" class="table">
- <thead>
- <tr>
- <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>
- <th>Rx E 2</th>
- <th>Rx D 2</th>
- <th>Tx E 2</th>
- <th>Tx D 2</th>
- <th>Rx E 3</th>
- <th>Rx D 3</th>
- <th>Tx E 3</th>
- <th>Tx D 3</th>
- <th>Rx E 4</th>
- <th>Rx D 4</th>
- <th>Tx E 4</th>
- <th>Tx D 4</th>
- <th>Rx E W0</th>
- <th>Rx D W0</th>
- <th>Tx E W0</th>
- <th>Tx D W0</th>
- <th>Rx E W1</th>
- <th>Rx D W1</th>
- <th>Tx E W1</th>
- <th>Tx D W1</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($result as $row) {
- $class = '';
- $sql7 = "SELECT * FROM planet_log WHERE user=" . $row['user'];
- $stmt7 = $conn->prepare($sql7);
- $stmt7->execute();
- $result7 = $stmt7->fetch(PDO::FETCH_ASSOC);
- if ($row['lan1_rx_err'] != $result7['lan1_rx_err']) {
- $class = 'error';
- }
- echo "<tr>
- <td><a href='http://" . $row['ip'] . "' target='_BLANK'> " . $row['ip'] . "</a></td>
- <td><a href='http://portal.cgc.ge:8080/cgc/maininfo?phone=" . $row['user'] . "' target='_BLANK'> " . $row['user'] . "</a></td>
- <td $class>" . $row['lan1_rx_err'] . "-" . $result7['lan1_rx_err'] . "</td>
- <td $class>" . $row['lan1_rx_drop'] . "</td>
- <td $class>" . $row['lan1_tx_drop'] . "</td>
- <td $class>" . $row['lan1_tx_drop'] . "</td>
- <td $class>" . $row['lan2_rx_err'] . "</td>
- <td $class>" . $row['lan2_rx_drop'] . "</td>
- <td $class>" . $row['lan2_tx_drop'] . "</td>
- <td $class>" . $row['lan2_tx_drop'] . "</td>
- <td $class>" . $row['lan3_rx_err'] . "</td>
- <td $class>" . $row['lan3_rx_drop'] . "</td>
- <td $class>" . $row['lan3_tx_drop'] . "</td>
- <td $class>" . $row['lan3_tx_drop'] . "</td>
- <td $class>" . $row['lan4_rx_err'] . "</td>
- <td $class>" . $row['lan4_rx_drop'] . "</td>
- <td $class>" . $row['lan4_tx_drop'] . "</td>
- <td $class>" . $row['lan4_tx_drop'] . "</td>
- <td $class>" . $row['WAN0_rx_err'] . "</td>
- <td $class>" . $row['WAN0_rx_drop'] . "</td>
- <td $class>" . $row['WAN0_tx_drop'] . "</td>
- <td $class>" . $row['WAN0_tx_drop'] . "</td>
- <td $class>" . $row['WAN1_rx_err'] . "</td>
- <td $class>" . $row['WAN1_rx_drop'] . "</td>
- <td $class>" . $row['WAN1_tx_drop'] . "</td>
- <td $class>" . $row['WAN1_tx_drop'] . "</td>
- </tr>";
- }
- ?>
- </tbody>
- </table>
- <script>
- $(document).ready(function () {
- var table = $('#myTable').DataTable({
- "pageLength": 100
- });
- var rows = table
- .rows(function (idx, data, node) {
- return data.highlight ? true : false;
- })
- .nodes();
- $(rows).addClass('highlight');
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement