1
0

unknown.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . $language . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  5. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datefilter.php");
  6. if (isset($_POST['device_show'])) { $f_id = $_POST['device_show'] * 1; }
  7. if (isset($_GET['device_show'])) { $f_id = $_GET['device_show'] * 1; }
  8. if (!isset($f_id) and isset($_SESSION[$page_url]['device_show'])) { $f_id=$_SESSION[$page_url]['device_show']; }
  9. if (!isset($f_id)) { $f_id=0; }
  10. $_SESSION[$page_url]['device_show']=$f_id;
  11. print_log_submenu($page_url);
  12. $where_dev = "";
  13. if ($f_id > 0) { $where_dev = " and D.id=$f_id "; }
  14. ?>
  15. <div id="cont">
  16. <br>
  17. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  18. Отчёт по свичу&nbsp<?php print_device_select($db_link, "device_show", $f_id); ?>
  19. Начало:&nbsp<input type="date" name="date_start" value="<?php echo $date1; ?>" />
  20. Конец:&nbsp<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
  21. Отображать:<?php print_row_at_pages('rows',$displayed); ?>
  22. <input type="submit" value="OK">
  23. </form>
  24. <?php
  25. $countSQL="SELECT Count(*) FROM Unknown_mac AS U, devices AS D, device_ports AS DP WHERE U.device_id = D.id AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev";
  26. $res = mysqli_query($db_link, $countSQL);
  27. $count_records = mysqli_fetch_array($res);
  28. $total=ceil($count_records[0]/$displayed);
  29. if ($page>$total) { $page=$total; }
  30. if ($page<1) { $page=1; }
  31. $start = ($page * $displayed) - $displayed;
  32. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  33. ?>
  34. <br>
  35. <table class="data" width="750">
  36. <tr align="center">
  37. <td class="data" width=110><b>Switch</b></td>
  38. <td class="data"><b>Port</b></td>
  39. <td class="data"><b>Mac</b></td>
  40. <td class="data"><b>Last found</b></td>
  41. </tr>
  42. <?php
  43. $sSQL = "SELECT U.mac, U.timestamp, DP.port, D.device_name FROM Unknown_mac AS U, devices AS D, device_ports AS DP WHERE U.device_id = D.id AND U.port_id = DP.id AND U.timestamp>='$date1' AND U.timestamp<'$date2' $where_dev ORDER BY U.mac LIMIT $start,$displayed";
  44. $maclog = get_records_sql($db_link, $sSQL);
  45. foreach ($maclog as $row) {
  46. print "<tr align=center align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  47. print "<td class=\"data\">" . $row['device_name'] . "</td>\n";
  48. print "<td class=\"data\">" . $row['port'] . "</td>\n";
  49. print "<td class=\"data\"><a href=/admin/logs/mac.php?mac=" . mac_simplify($row['mac']) . ">" . mac_dotted($row['mac']) . "</a></td>\n";
  50. print "<td class=\"data\">" . $row['timestamp'] . "</td>\n";
  51. print "</tr>\n";
  52. }
  53. print "</table>\n";
  54. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  55. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  56. ?>