syslog.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/datetimefilter.php");
  6. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/logfilter.php");
  7. if (isset($_POST['device_show'])) { $f_id = $_POST['device_show']*1; }
  8. if (isset($_GET['device_show'])) { $f_id = $_GET['device_show']*1; }
  9. if (!isset($f_id) and isset($_SESSION[$page_url]['device_show'])) { $f_id=$_SESSION[$page_url]['device_show']*1; }
  10. if (!isset($f_id)) { $f_id=0; }
  11. $_SESSION[$page_url]['device_show']=$f_id;
  12. print_log_submenu($page_url);
  13. $log_filter = "";
  14. if ($f_id>0) {
  15. $dev_ips=get_device_ips($db_link,$f_id);
  16. $log_filter=' and `ip` IN (';
  17. foreach ($dev_ips as $index => $ip) {
  18. $log_filter=$log_filter."'".$ip."',";
  19. }
  20. $log_filter = preg_replace('/\,$/', '',$log_filter);
  21. $log_filter = $log_filter .")";
  22. }
  23. ?>
  24. <div id="cont">
  25. <br>
  26. <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  27. <?php print_date_fields($date1,$date2,$date_shift); ?>
  28. <?php echo WEB_log_report_by_device; ?>&nbsp <?php print_device_select($db_link, "device_show", $f_id); ?>
  29. <?php print WEB_rows_at_page."&nbsp"; print_row_at_pages('rows',$displayed); ?>
  30. <input type="submit" value="<?php echo WEB_btn_show; ?>"><br><br>
  31. <?php echo WEB_log_filter_event; ?>:<input name="message" value="<?php echo $fmessage; ?>" />
  32. </form>
  33. <?php
  34. if (!empty($fmessage)) { $log_filter .= " AND `message` LIKE '%" . addslashes($fmessage) . "%'"; }
  35. $countSQL="SELECT Count(*) FROM `remote_syslog` WHERE `date`>='$date1' AND `date`<'$date2' $log_filter";
  36. $res = mysqli_query($db_link, $countSQL);
  37. $count_records = mysqli_fetch_array($res);
  38. $total=ceil($count_records[0]/$displayed);
  39. if ($page>$total) { $page=$total; }
  40. if ($page<1) { $page=1; }
  41. $start = ($page * $displayed) - $displayed;
  42. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  43. #speedup pageing
  44. $sSQL = "SELECT * FROM (SELECT * FROM `remote_syslog` WHERE `date`>='$date1' AND `date`<'$date2' $log_filter) as R ORDER BY `date` DESC LIMIT $start,$displayed";
  45. ?>
  46. <br>
  47. <table class="data" width="90%">
  48. <tr align="center">
  49. <td class="data" width=150><b><?php echo WEB_date; ?></b></td>
  50. <td class="data"><b><?php echo WEB_cell_ip; ?></b></td>
  51. <td class="data"><b><?php echo WEB_log_event; ?></b></td>
  52. </tr>
  53. <?php
  54. $syslog = get_records_sql($db_link, $sSQL);
  55. if (!empty($syslog)) {
  56. foreach ($syslog as $row) {
  57. print "<tr align=center class=\"tr1\" onmouseover=\"className='tr2'\" onmouseout=\"className='tr1'\">\n";
  58. print "<td class=\"data\">" . $row['date'] . "</td>\n";
  59. print "<td class=\"data\">" . $row['ip'] . "</td>\n";
  60. print "<td class=\"data\">" . $row['message'] . "</td>\n";
  61. print "</tr>\n";
  62. }
  63. }
  64. print "</table>\n";
  65. print_navigation($page_url,$page,$displayed,$count_records[0],$total);
  66. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php");
  67. ?>