1
0

mac.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/cidrfilter.php");
  6. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datetimefilter.php");
  7. if (isset($_POST['mac'])) { $f_mac = mac_simplify($_POST['mac']); }
  8. if (isset($_GET['mac'])) { $f_mac = mac_simplify($_GET['mac']); }
  9. if (!isset($f_mac) and isset($_SESSION[$page_url]['mac'])) { $f_mac=$_SESSION[$page_url]['mac']; }
  10. if (!isset($f_mac)) { $f_mac=''; }
  11. $_SESSION[$page_url]['mac']=$f_mac;
  12. $mac_where = '';
  13. if (!empty($f_mac)) { $mac_where = " and mac='$f_mac' "; }
  14. print_log_submenu($page_url);
  15. ?>
  16. <div id="cont">
  17. <br>
  18. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  19. <?php print_date_fields($date1,$date2,$date_shift); ?>
  20. <?php echo WEB_cell_mac; ?>:&nbsp<input type="text" name="mac" value="<?php echo mac_dotted($f_mac); ?>" pattern="^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}|([0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4}[\\.-][0-9a-fA-F]{4})|[0-9A-Fa-f]{12}$" />
  21. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  22. <input type="submit" value="<?php echo WEB_btn_show; ?>">
  23. </form>
  24. <?php
  25. $countSQL="SELECT Count(*) FROM mac_history WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $mac_where ORDER BY id DESC";
  26. $count_records = get_single_field($db_link,$countSQL);
  27. $total=ceil($count_records/$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,$total);
  32. ?>
  33. <br>
  34. <table class="data" width="850">
  35. <tr align="center">
  36. <td class="data" width=150><b><?php echo WEB_log_time; ?></b></td>
  37. <td class="data"><b><?php echo WEB_cell_mac; ?></b></td>
  38. <td class="data"><b><?php echo WEB_cell_connection; ?></b></td>
  39. <td class="data"><b><?php echo WEB_cell_ip; ?></b></td>
  40. </tr>
  41. <?php
  42. $sSQL = "SELECT * FROM mac_history WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $mac_where ORDER BY `timestamp` DESC 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['timestamp'] . "</td>\n";
  47. print "<td class=\"data\">" . expand_mac($db_link,mac_dotted($row['mac'])) . "</td>\n";
  48. print "<td class=\"data\">" . get_port($db_link, $row['port_id']) . "</td>\n";
  49. if (isset($row['auth_id']) and $row['auth_id'] > 0) {
  50. print "<td class=\"data\"><a href=/admin/users/editauth.php?id=".$row['auth_id'].">" . $row['ip'] . "</a></td>\n";
  51. } else {
  52. print "<td class=\"data\">" . $row['ip'] . "</td>\n";
  53. }
  54. print "</tr>\n";
  55. }
  56. print "</table>\n";
  57. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  58. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  59. ?>