1
0

unknown.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. $count_records = get_single_field($db_link,$countSQL);
  26. $total=ceil($count_records/$displayed);
  27. if ($page>$total) { $page=$total; }
  28. if ($page<1) { $page=1; }
  29. $start = ($page * $displayed) - $displayed;
  30. print_navigation($page_url,$page,$displayed,$count_records,$total);
  31. ?>
  32. <br>
  33. <table class="data" width="750">
  34. <tr align="center">
  35. <td class="data" width=110><b><?php echo WEB_cell_connection; ?></b></td>
  36. <td class="data"><b><?php echo WEB_device_port_name; ?></b></td>
  37. <td class="data"><b><?php echo WEB_cell_mac; ?></b></td>
  38. <td class="data"><b><?php echo WEB_cell_last_found; ?></b></td>
  39. </tr>
  40. <?php
  41. $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";
  42. $maclog = get_records_sql($db_link, $sSQL);
  43. foreach ($maclog as $row) {
  44. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  45. print "<td class=\"data\">" . $row['device_name'] . "</td>\n";
  46. print "<td class=\"data\">" . $row['port'] . "</td>\n";
  47. print "<td class=\"data\"><a href=/admin/logs/mac.php?mac=" . mac_simplify($row['mac']) . ">" . mac_dotted($row['mac']) . "</a></td>\n";
  48. print "<td class=\"data\">" . $row['timestamp'] . "</td>\n";
  49. print "</tr>\n";
  50. }
  51. print "</table>\n";
  52. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  53. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  54. ?>