1
0

index.php 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. $default_date_shift='d';
  6. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/datefilter.php");
  7. $default_sort='tin';
  8. $default_order='DESC';
  9. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/oufilter.php");
  10. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/sortfilter.php");
  11. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/gatefilter.php");
  12. print_reports_submenu($page_url);
  13. ?>
  14. <div id="cont">
  15. <form action="index.php" method="post">
  16. <?php echo WEB_cell_ou; ?>:&nbsp<?php print_ou_select($db_link,'ou',$rou); ?>
  17. <?php echo WEB_log_start_date; ?>:&nbsp<input type="date" name="date_start" value="<?php echo $date1; ?>" />
  18. <?php echo WEB_log_stop_date; ?>:&nbsp<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
  19. <?php echo WEB_cell_gateway; ?>:&nbsp<?php print_gateway_select($db_link, 'gateway', $rgateway); ?>
  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. print "<br><br>\n";
  25. print "<table class=\"data\">\n";
  26. print "<tr class=\"info\">\n";
  27. print "<td ><b><a href=index.php?sort=login&order=$new_order>".WEB_cell_login."</a></b></td>\n";
  28. print "<td ><b>".WEB_cell_gateway."</b></td>\n";
  29. print "<td ><b><a href=index.php?sort=tin&order=$new_order>".WEB_title_input."</a></b></td>\n";
  30. print "<td ><b><a href=index.php?sort=tout&order=$new_order>".WEB_title_output."<a></b></td>\n";
  31. print "</tr>\n";
  32. $sort_sql=" ORDER BY tin DESC";
  33. if (!empty($sort_field) and !empty($order)) { $sort_sql = " ORDER BY $sort_field $order"; }
  34. $gateway_list = get_gateways($db_link);
  35. $trafSQL = "SELECT
  36. User_list.login,User_list.ou_id,User_auth.user_id, User_stats.auth_id,
  37. User_stats.router_id, SUM( byte_in ) AS tin, SUM( byte_out ) AS tout
  38. FROM User_stats,User_auth,User_list WHERE User_list.id=User_auth.user_id
  39. AND User_stats.auth_id = User_auth.id
  40. AND User_stats.timestamp>='$date1'
  41. AND User_stats.timestamp<'$date2'
  42. ";
  43. if ($rou !== 0) { $trafSQL = $trafSQL . " AND User_list.ou_id=$rou"; }
  44. if ($rgateway == 0) {
  45. $trafSQL = $trafSQL . " GROUP by User_auth.user_id,User_stats.router_id";
  46. } else {
  47. $trafSQL = $trafSQL . " AND User_stats.router_id=$rgateway GROUP by User_auth.user_id,User_stats.router_id";
  48. }
  49. #set sort
  50. $trafSQL=$trafSQL ." $sort_sql";
  51. $total_in = 0;
  52. $total_out = 0;
  53. $traf = mysqli_query($db_link, $trafSQL);
  54. while (list ($s_login,$s_ou_id,$u_id,$s_auth_id, $s_router_id, $traf_day_in, $traf_day_out) = mysqli_fetch_array($traf)) {
  55. if ($traf_day_in + $traf_day_out ==0) { continue; }
  56. $total_in += $traf_day_in;
  57. $total_out += $traf_day_out;
  58. if (!empty($gateway_list[$s_router_id])) { $s_router = $gateway_list[$s_router_id]; } else { $s_router=''; }
  59. $cl = "data";
  60. if ($traf_day_out > 2 * $traf_day_in) { $cl = "nb"; }
  61. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  62. print "<td align=left class=\"$cl\"><a href=userday.php?id=$u_id&date_start=$date1&date_stop=$date2>$s_login</a></td>\n";
  63. print "<td align=left class=\"$cl\">$s_router</td>\n";
  64. print "<td class=\"$cl\">" . fbytes($traf_day_in) . "</td>\n";
  65. print "<td class=\"$cl\">" . fbytes($traf_day_out) . "</td>\n";
  66. print "</tr>\n";
  67. }
  68. print "<tr align=center align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  69. print "<td class=\"data\" colspan=2><b>".WEB_title_itog."</b></td>\n";
  70. print "<td class=\"data\"><b>" . fbytes($total_in) . "</b></td>\n";
  71. print "<td class=\"data\"><b>" . fbytes($total_out) . "</b></td>\n";
  72. print "</tr>\n";
  73. ?>
  74. </table>
  75. <?php
  76. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  77. ?>