userdaydetaillog.php 5.6 KB

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