userdaydetaillog.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/idfilter.php");
  6. $default_date_shift='h';
  7. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datetimefilter.php");
  8. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/gatefilter.php");
  9. $default_sort='id';
  10. $sort_table = 'A';
  11. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sortfilter.php");
  12. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/search.php");
  13. $rdns = 0;
  14. if (isset($_POST['dns'])) { $rdns=$_POST['dns']*1; }
  15. $_SESSION[$page_url]['dns']=$rdns;
  16. $dns_checked='';
  17. if ($rdns) { $dns_checked='checked="checked"'; }
  18. $dns_cache=NULL;
  19. $usersip = mysqli_query($db_link, "SELECT ip,user_id,comments FROM User_auth WHERE User_auth.id=$id");
  20. list ($fip, $parent, $fcomm) = mysqli_fetch_array($usersip);
  21. print_trafdetail_submenu($page_url,"id=$id&date_start='$date1'&date_stop='$date2'","<b>".WEB_log_detail_for."&nbsp<a href=/admin/users/editauth.php?id=$id>$fip</a></b> ::&nbsp");
  22. ?>
  23. <div id="contsubmenu">
  24. <form action="<?php print $page_url; ?>" method="post">
  25. <input type="hidden" name="id" value=<?php echo $id; ?>>
  26. <?php echo WEB_log_start_date; ?>:&nbsp<input type="datetime-local" name="date_start" value="<?php echo $date1; ?>" />
  27. <?php echo WEB_log_stop_date; ?>:&nbsp<input type="datetime-local" name="date_stop" value="<?php echo $date2; ?>" />
  28. <?php echo WEB_cell_gateway; ?>:&nbsp <?php print_gateway_select($db_link, 'gateway', $rgateway); ?>
  29. DNS:&nbsp <input type=checkbox name=dns value="1" <?php print $dns_checked; ?>>
  30. <?php echo WEB_search; ?>:&nbsp<input type="text" minlength="7" maxlength="15" size="15" pattern="^(?>(\d|[1-9]\d{2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?1)$" name="search" value="<?php echo $search; ?>" />
  31. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  32. <input type="submit" value="<?php echo WEB_btn_show; ?>">
  33. </form>
  34. <b><?php echo WEB_log_full; ?></b>
  35. <?php
  36. $sort_url = "<a href='userdaydetaillog.php?id=".$id.'&date_start="'.$date1.'"&date_stop="'.$date2.'"';
  37. $gateway_filter='';
  38. if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
  39. if (!empty($search)) { $gateway_filter.=' (src_ip='.ip2long($search).' OR dst_ip='.ip2long($search).') AND'; }
  40. $countSQL="SELECT Count(*) FROM Traffic_detail as A WHERE $gateway_filter (auth_id='$id') and `timestamp`>='$date1' and `timestamp`<'$date2'";
  41. $res = mysqli_query($db_link, $countSQL);
  42. $count_records = mysqli_fetch_array($res);
  43. $total=ceil($count_records[0]/$displayed);
  44. if ($page>$total) { $page=$total; }
  45. if ($page<1) { $page=1; }
  46. $start = ($page * $displayed) - $displayed;
  47. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  48. $gateway_list = get_gateways($db_link);
  49. ?>
  50. <br>
  51. <table class="data">
  52. <tr align="center">
  53. <td class="data" width=150><b><?php $url = $sort_url.'&sort=timestamp&order='.$new_order."'>".WEB_date."</a>"; print $url; ?></b></td>
  54. <td class="data" width=30><b><?php echo WEB_cell_gateway; ?></b></td>
  55. <td class="data" width=30><b><?php echo WEB_traffic_proto; ?></b></td>
  56. <td class="data" width=150><b><?php $url = $sort_url.'&sort=src_ip&order='.$new_order."'>".WEB_traffic_source_address."</a>"; print $url; ?></b></td>
  57. <td class="data"><b>DNS</b></td>
  58. <td class="data" width=50><b><?php echo WEB_traffic_src_port; ?></b></td>
  59. <td class="data" width=150><b><?php $url = $sort_url.'&sort=dst_ip&order='.$new_order."'>".WEB_traffic_dest_address."</a>"; print $url; ?></b></td>
  60. <td class="data"><b>DNS</b></td>
  61. <td class="data" width=50><b><?php echo WEB_traffic_dst_port; ?></b></td>
  62. <td class="data" width=80><b><?php $url = $sort_url.'&sort=bytes&order='.$new_order."'>".WEB_bytes."</a>"; print $url; ?></b></td>
  63. <td class="data" width=80><b><?php $url = $sort_url.'&sort=pkt&order='.$new_order."'>".WEB_pkts."</a>"; print $url; ?></b></td>
  64. </tr>
  65. <?php
  66. $fsql = "SELECT A.id, A.`timestamp`, A.router_id, A.proto, A.src_ip, A.src_port, A.dst_ip, A.dst_port, A.bytes, A.pkt FROM Traffic_detail as A JOIN (SELECT id FROM Traffic_detail
  67. WHERE $gateway_filter (auth_id='$id') and `timestamp`>='$date1' and `timestamp`<'$date2'
  68. ORDER BY `timestamp` ASC LIMIT $start,$displayed) as T ON A.id = T.id ORDER BY $sort_table.$sort_field $order";
  69. $userdata = mysqli_query($db_link, $fsql);
  70. while (list ($uid,$udata, $urouter, $uproto, $sip, $sport,$dip, $dport, $ubytes, $upkt) = mysqli_fetch_array($userdata)) {
  71. print "<tr align=center align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  72. print "<td class=\"data\">$udata</td>\n";
  73. print "<td class=\"data\">$gateway_list[$urouter]</td>\n";
  74. if ($uproto==='6') { $uproto = 'tcp'; }
  75. if ($uproto==='17') { $uproto = 'udp'; }
  76. print "<td class=\"data\">" . $uproto . "</td>\n";
  77. print "<td class=\"data\" align=left>" . long2ip($sip) . "</td>\n";
  78. $ip_name = '-';
  79. if ($rdns) { $ip_name = ResolveIP($db_link,$sip); }
  80. print "<td class=\"data\" align=left>" . $ip_name . "</td>\n";
  81. print "<td class=\"data\">" .$sport . "</td>\n";
  82. print "<td class=\"data\" align=left>" . long2ip($dip) . "</td>\n";
  83. $ip_name = '-';
  84. if ($rdns) { $ip_name = ResolveIP($db_link,$dip); }
  85. print "<td class=\"data\" align=left>" . $ip_name . "</td>\n";
  86. print "<td class=\"data\">" . $dport . "</td>\n";
  87. print "<td class=\"data\" align=right>" . fbytes($ubytes) . "</td>\n";
  88. print "<td class=\"data\" align=right>" . $upkt . "</td>\n";
  89. print "</tr>\n";
  90. }
  91. ?>
  92. </table>
  93. <?php print_navigation($page_url,$page,$displayed,$count_records[0],$total); ?>
  94. <br>
  95. <?php
  96. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  97. ?>