userdaydetail.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. $usersip = get_record_sql($db_link, "SELECT ip,user_id,comments FROM User_auth WHERE User_auth.id=$id");
  9. if (empty($usersip)) {
  10. header("location: /admin/reports/index-full.php");
  11. exit;
  12. }
  13. $fip = $usersip['ip'];
  14. $parent = $usersip['user_id'];
  15. $fcomm = $usersip['comments'];
  16. $rdns = 0;
  17. if (isset($_POST['dns'])) { $rdns=$_POST['dns']*1; }
  18. $_SESSION[$page_url]['dns']=$rdns;
  19. $dns_checked='';
  20. if ($rdns) { $dns_checked='checked="checked"'; }
  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="<?=$_SERVER['PHP_SELF']?>" method="post">
  25. <input type="hidden" name="id" value=<?php echo $id; ?>>
  26. <?php print_date_fields($date1,$date2,$date_shift); ?>
  27. <?php echo WEB_cell_gateway; ?>:&nbsp<?php print_gateway_select($db_link, 'gateway', $rgateway); ?>
  28. DNS:&nbsp <input type=checkbox name=dns value="1" <?php print $dns_checked; ?>>
  29. <input type="submit" value="<?php echo WEB_btn_show; ?>">
  30. </form>
  31. <br>
  32. <b><?php echo WEB_report_top10_in; ?></b>
  33. <table class="data">
  34. <tr align="center">
  35. <td class="data" width=30><b><?php echo WEB_traffic_proto; ?></b></td>
  36. <td class="data" width=150><b><?php echo WEB_traffic_source_address; ?></b></td>
  37. <td class="data"><b>DNS</b></td>
  38. <td class="data" width=50><b><?php echo WEB_traffic_src_port; ?></b></td>
  39. <td class="data" width=80><b><?php echo WEB_bytes; ?></b></td>
  40. </tr>
  41. <?php
  42. $ip_aton = ip2long($fip);
  43. $gateway_filter='';
  44. if (!empty($rgateway) and $rgateway>0) { $gateway_filter="(router_id=$rgateway) AND"; }
  45. $fsql = "SELECT A.proto, A.src_ip, A.src_port, SUM(A.bytes) as tin FROM Traffic_detail A
  46. WHERE $gateway_filter (auth_id='$id') and `timestamp`>='$date1' and `timestamp`<'$date2' and (A.dst_ip='$ip_aton')
  47. GROUP BY A.src_ip, A.src_port, A.proto ORDER BY tin DESC LIMIT 0,10";
  48. $userdata = get_records_sql($db_link, $fsql);
  49. foreach ($userdata as $row) {
  50. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  51. $proto_name = getprotobynumber($row['proto']);
  52. if (!$proto_name) { $proto_name = $row['proto']; }
  53. print "<td class=\"data\">" . $proto_name . "</td>\n";
  54. print "<td class=\"data\" align=left>" . long2ip($row['src_ip']) . "</td>\n";
  55. $ip_name = '-';
  56. if ($rdns) { $ip_name = ResolveIP($db_link, $row['src_ip']); }
  57. print "<td class=\"data\" align=left>" . $ip_name . "</td>\n";
  58. print "<td class=\"data\">" . $row['src_port'] . "</td>\n";
  59. print "<td class=\"data\" align=right>" . fbytes($row['tin']) . "</td>\n";
  60. print "</tr>\n";
  61. }
  62. ?>
  63. </table>
  64. <b><?php echo WEB_report_top10_out; ?></b>
  65. <table class="data">
  66. <tr align="center">
  67. <td class="data" width=30><b><?php echo WEB_traffic_proto; ?></b></td>
  68. <td class="data" width=150><b><?php echo WEB_traffic_dest_address; ?></b></td>
  69. <td class="data"><b>DNS</b></td>
  70. <td class="data" width=50><b><?php echo WEB_traffic_dst_port; ?></b></td>
  71. <td class="data" width=80><b><?php echo WEB_bytes; ?></b></td>
  72. </tr>
  73. <?php
  74. $fsql = "SELECT A.proto, A.dst_ip, A.dst_port, SUM(A.bytes) as tout FROM Traffic_detail A
  75. WHERE $gateway_filter (auth_id='$id') and `timestamp`>='$date1' and `timestamp`<'$date2' and (A.src_ip='$ip_aton')
  76. GROUP BY A.dst_ip, A.dst_port, A.proto ORDER BY tout DESC LIMIT 0,10";
  77. $userdata = get_records_sql($db_link, $fsql);
  78. foreach ($userdata as $row) {
  79. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  80. $proto_name = getprotobynumber($row['proto']);
  81. if (!$proto_name) { $proto_name = $row['proto']; }
  82. print "<td class=\"data\">" . $proto_name . "</td>\n";
  83. print "<td class=\"data\" align=left>" . long2ip($row['dst_ip']) . "</td>\n";
  84. $ip_name = '-';
  85. if ($rdns) { $ip_name = ResolveIP($db_link, $row['dst_ip']); }
  86. print "<td class=\"data\" align=left>" . $ip_name . "</td>\n";
  87. print "<td class=\"data\">" . $row['dst_port'] . "</td>\n";
  88. print "<td class=\"data\" align=right>" . fbytes($row['tout']) . "</td>\n";
  89. print "</tr>\n";
  90. }
  91. ?>
  92. </table>
  93. <?php
  94. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  95. ?>