index.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/loglevelfilter.php");
  8. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/logfilter.php");
  9. print_log_submenu($page_url);
  10. ?>
  11. <div id="cont">
  12. <br>
  13. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  14. <?php echo WEB_log_start_date; ?>:<input type="date" name="date_start" value="<?php echo $date1; ?>" />
  15. <?php echo WEB_log_stop_date; ?>:<input type="date" name="date_stop" value="<?php echo $date2; ?>" />
  16. <?php echo WEB_log_level_display; ?>:<?php print_loglevel_select('display_log_level',$display_log_level); ?>
  17. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  18. <input type="submit" value="<?php echo WEB_btn_show; ?>"><br><br>
  19. <?php echo WEB_log_filter_source; ?>:<input name="customer" value="<?php echo $fcustomer; ?>" />
  20. <?php echo WEB_log_event; ?>:<input name="message" value="<?php echo $fmessage; ?>" />
  21. </form>
  22. <?php
  23. $log_filter ='';
  24. if ($display_log_level == L_ERROR) { $log_filter = " and `level`=". L_ERROR." "; }
  25. if ($display_log_level == L_WARNING) { $log_filter = " and `level`<=".L_WARNING." "; }
  26. if ($display_log_level == L_INFO) { $log_filter = " and `level`<=".L_INFO." "; }
  27. if ($display_log_level == L_VERBOSE) { $log_filter = " and `level`<=".L_VERBOSE." "; }
  28. if ($display_log_level == L_DEBUG) { $log_filter = ""; }
  29. if (!empty($fcustomer)) { $log_filter = $log_filter." and customer LIKE '%".$fcustomer."%'"; }
  30. if (!empty($fmessage)) { $log_filter = $log_filter." and message LIKE '%".$fmessage."%'"; }
  31. $countSQL="SELECT Count(*) FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter";
  32. $res = mysqli_query($db_link, $countSQL);
  33. $count_records = mysqli_fetch_array($res);
  34. $total=ceil($count_records[0]/$displayed);
  35. if ($page>$total) { $page=$total; }
  36. if ($page<1) { $page=1; }
  37. $start = ($page * $displayed) - $displayed;
  38. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  39. ?>
  40. <br>
  41. <table class="data">
  42. <tr align="center">
  43. <td class="data" width=150><b><?php echo WEB_log_time; ?></b></td>
  44. <td class="data"><b><?php echo WEB_log_manager; ?></b></td>
  45. <td class="data"><b><?php echo WEB_log_level; ?></b></td>
  46. <td class="data"><b><?php echo WEB_log_event; ?></b></td>
  47. </tr>
  48. <?php
  49. #speedup paging
  50. $sSQL = "SELECT `timestamp`,customer,message,level FROM worklog as S JOIN (SELECT id FROM worklog WHERE `timestamp`>='$date1' AND `timestamp`<'$date2' $log_filter ORDER BY id DESC LIMIT $start,$displayed) AS I ON S.id = I.id";
  51. $userlog = get_records_sql($db_link, $sSQL);
  52. foreach ($userlog as $row) {
  53. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  54. print "<td class=\"data\">" . $row['timestamp'] . "</td>\n";
  55. print "<td class=\"data\">" . $row['customer'] . "</td>\n";
  56. $msg_level = 'INFO';
  57. if ($row['level'] == L_ERROR) { $msg_level='ERROR'; }
  58. if ($row['level'] == L_WARNING) { $msg_level='WARNING'; }
  59. if ($row['level'] == L_DEBUG) { $msg_level='DEBUG'; }
  60. if ($row['level'] == L_VERBOSE) { $msg_level='VERBOSE'; }
  61. print "<td class=\"data\">" . $msg_level . "</td>\n";
  62. $print_msg = expand_log_str($db_link, $row['message']);
  63. print "<td class=\"data\" align=left>" . $print_msg . "</td>\n";
  64. print "</tr>\n";
  65. }
  66. print "</table>\n";
  67. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  68. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  69. ?>