1
0

unknown.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datetimefilter.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. <?php echo WEB_log_report_by_device; ?>&nbsp<?php print_netdevice_select($db_link, "device_show", $f_id); ?>
  19. <?php print_date_fields($date1,$date2,$date_shift); ?>
  20. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  21. <input type="submit" value="<?php echo WEB_btn_show; ?>">
  22. </form>
  23. <?php
  24. $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";
  25. $res = mysqli_query($db_link, $countSQL);
  26. $count_records = mysqli_fetch_array($res);
  27. $total=ceil($count_records[0]/$displayed);
  28. if ($page>$total) { $page=$total; }
  29. if ($page<1) { $page=1; }
  30. $start = ($page * $displayed) - $displayed;
  31. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  32. ?>
  33. <br>
  34. <table class="data" width="750">
  35. <tr align="center">
  36. <td class="data" width=110><b><?php echo WEB_cell_connection; ?></b></td>
  37. <td class="data"><b><?php echo WEB_device_port_name; ?></b></td>
  38. <td class="data"><b><?php echo WEB_cell_mac; ?></b></td>
  39. <td class="data"><b><?php echo WEB_cell_last_found; ?></b></td>
  40. </tr>
  41. <?php
  42. $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";
  43. $maclog = get_records_sql($db_link, $sSQL);
  44. foreach ($maclog as $row) {
  45. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  46. print "<td class=\"data\">" . $row['device_name'] . "</td>\n";
  47. print "<td class=\"data\">" . $row['port'] . "</td>\n";
  48. print "<td class=\"data\"><a href=/admin/logs/mac.php?mac=" . mac_simplify($row['mac']) . ">" . mac_dotted($row['mac']) . "</a></td>\n";
  49. print "<td class=\"data\">" . $row['timestamp'] . "</td>\n";
  50. print "</tr>\n";
  51. }
  52. print "</table>\n";
  53. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  54. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  55. ?>