1
0

unknown.php 2.9 KB

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