The web based syslog https://lggr.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

do.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. spl_autoload_register(
  3. function ($class) {
  4. include 'inc/' . strtolower($class) . '_class.php';
  5. });
  6. session_start();
  7. if (! isset($_REQUEST['a'])) {
  8. header('Location: index.php');
  9. exit();
  10. } // if
  11. if (isset($_SESSION[LggrState::SESSIONNAME])) {
  12. $state = $_SESSION[LggrState::SESSIONNAME];
  13. } else {
  14. $state = new LggrState();
  15. } // if
  16. // Are we talking to the user or is this an internal call?
  17. $isAjax = false;
  18. switch ($_REQUEST['a']) {
  19. case 'reset':
  20. $state = new LggrState();
  21. break;
  22. case 'search':
  23. $state = new LggrState();
  24. if ('' != trim($_POST['prog'])) {
  25. $state->setSearchProg(trim($_POST['prog']));
  26. }
  27. if ('' != trim($_POST['q'])) {
  28. $state->setSearch(trim($_POST['q']));
  29. } // if
  30. break;
  31. case 'host':
  32. $config = new Config();
  33. $l = new Lggr($state, $config);
  34. $id = intval($_GET['hostid']);
  35. $state->setHostName($l->getServersName($id));
  36. $state->setHostId($id);
  37. $state->setPage(0);
  38. $state->setResultSize(0);
  39. break;
  40. case 'level':
  41. $state->setLevel($_GET['level']);
  42. $state->setPage(0);
  43. $state->setResultSize(0);
  44. break;
  45. case 'range':
  46. $state->setRange(intval($_GET['range']));
  47. $state->setPage(0);
  48. $state->setResultSize(0);
  49. $state->setFromTo(null, null);
  50. break;
  51. case 'fromto':
  52. $sFrom = $_POST['tsfrom'];
  53. $sTo = $_POST['tsto'];
  54. $state->setFromTo($sFrom, $sTo);
  55. $state->setRange(null);
  56. $state->setPage(0);
  57. $state->setResultSize(0);
  58. break;
  59. case 'paginate':
  60. if (isset($_GET['page'])) {
  61. $i = intval($_GET['page']);
  62. if ($i < 0) {
  63. $i = 0;
  64. }
  65. $page = $i;
  66. $state->setPage($page);
  67. } // if
  68. break;
  69. case 'panelopen':
  70. $state->setPanelOpen(true);
  71. $isAjax = true;
  72. $sAjaxReply = 'OK';
  73. break;
  74. case 'panelclose':
  75. $state->setPanelOpen(false);
  76. $isAjax = true;
  77. $sAjaxReply = 'OK';
  78. break;
  79. case 'archive':
  80. $config = new AdminConfig();
  81. $l = new Lggr($state, $config);
  82. $iID = intval($_REQUEST['id']);
  83. $l->setArchive($iID, true);
  84. $isAjax = true;
  85. $sAjaxReply = $iID;
  86. break;
  87. case 'unarchive':
  88. $config = new AdminConfig();
  89. $l = new Lggr($state, $config);
  90. $iID = intval($_REQUEST['id']);
  91. $l->setArchive($iID, false);
  92. $isAjax = true;
  93. $sAjaxReply = $iID;
  94. break;
  95. case 'exportarchive':
  96. $config = new Config();
  97. $l = new Lggr($state, $config);
  98. $csv = new LggrCsv($l);
  99. $csv->generiere();
  100. exit();
  101. break;
  102. default:
  103. // no idea what to do, just ignore it
  104. break;
  105. } // switch
  106. $_SESSION[LggrState::SESSIONNAME] = $state;
  107. if ($isAjax) {
  108. header('Content-Type: text/plain');
  109. echo $sAjaxReply;
  110. } else {
  111. header('Location: index.php');
  112. } // if
Social stuff:
Mastodon