$number_lines) array_shift($lines); continue; } } } fclose($fp); } else { $lines[] = "No log entry found...\n"; $lines[] = "The logfile will be created with next startup.\n"; } return $lines; } $number_lines = 20; if (isset($_POST['number'])) { if($_POST['number'] == 20) { $number_lines = 20; } elseif($_POST['number'] == 50) { $number_lines = 50; } elseif($_POST['number'] == 100) { $number_lines = 100; } elseif($_POST['number'] == 200) { $number_lines = 200; } elseif($_POST['number'] == 500) { $number_lines = 500; } elseif($_POST['number'] == 9999) { $number_lines = 9999; } else { $number_lines = 20; } $_SESSION['number_lines'] = $number_lines; } elseif (isset($_SESSION['number_lines'])) { $number_lines = $_SESSION['number_lines']; } $filters = ''; if (isset($_POST['logfilter']) && in_array('critical', $_POST['logfilter'])) { $filters .= "CRITICAL,"; } if (isset($_POST['logfilter']) && in_array('error', $_POST['logfilter'])) { $filters .= "ERROR,"; } if (isset($_POST['logfilter']) && in_array('warning', $_POST['logfilter'])) { $filters .= "WARNING,"; } if (isset($_POST['logfilter']) && in_array('notice', $_POST['logfilter'])) { $filters .= "NOTICE,"; } if (isset($_POST['logfilter']) && in_array('info', $_POST['logfilter'])) { $filters .= "INFO,"; } if (isset($_POST['logfilter']) && in_array('debug', $_POST['logfilter'])) { $filters .= "DEBUG,"; } if($filters != '') { $_SESSION['logfilter'] = $filters; } if (!isset($_SESSION['logfilter'])) { $_SESSION['logfilter'] = "CRITICAL,ERROR,WARNING,NOTICE,INFO,DEBUG"; } $filters = explode(',', $_SESSION['logfilter']); if (isset($_POST['logout'])) { echo "logout"; $_SESSION = array(); session_destroy(); if($_SERVER['HTTPS'] == "on") { header("Location: https://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')); } else { header("Location: http://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')); } exit; } if (!isset($_SESSION['username']) || $_SESSION['username'] != $webuser || $_SESSION['password'] != $webpass || $_SESSION['clientip'] != getclientip()) { if($_SERVER['HTTPS'] == "on") { header("Location: https://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')); } else { header("Location: http://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')); } exit; } require_once('nav.php'); $logoutput = getlog($logpath,$number_lines,$filters); if (isset($_POST['start']) && $_SESSION['username'] == $webuser && $_SESSION['password'] == $webpass && $_SESSION['clientip'] == getclientip()) { if (substr(php_uname(), 0, 7) == "Windows") { $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("cmd /C php ".substr(__DIR__,0,-12)."\worker.php start", 0, false); } else { exec("php ".substr(__DIR__,0,-12)."worker.php start"); } $err_msg = $lang['wibot2']; $err_lvl = 1; usleep(80000); $logoutput = getlog($logpath,$number_lines,$filters); } if (isset($_POST['stop']) && $_SESSION['username'] == $webuser && $_SESSION['password'] == $webpass && $_SESSION['clientip'] == getclientip()) { if (substr(php_uname(), 0, 7) == "Windows") { $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("cmd /C php ".substr(__DIR__,0,-12)."\worker.php stop", 0, false); } else { exec("php ".substr(__DIR__,0,-12)."worker.php stop"); } $err_msg = $lang['wibot1']; $err_lvl = 1; usleep(80000); $logoutput = getlog($logpath,$number_lines,$filters); } if (isset($_POST['restart']) && $_SESSION['username'] == $webuser && $_SESSION['password'] == $webpass && $_SESSION['clientip'] == getclientip()) { if (substr(php_uname(), 0, 7) == "Windows") { $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("cmd /C php ".substr(__DIR__,0,-12)."\worker.php restart", 0, false); } else { exec("php ".substr(__DIR__,0,-12)."worker.php restart"); } $err_msg = $lang['wibot3']; $err_lvl = 1; usleep(80000); $logoutput = getlog($logpath,$number_lines,$filters); } $disabled = ''; if($ts['host'] == NULL || $ts['query'] == NULL || $ts['voice'] == NULL || $ts['user'] == NULL || $ts['pass'] == NULL || $queryname == NULL || $queryname2 == NULL || $grouptime == NULL || $logpath == NULL) { $disabled = 1; $err_msg = $lang['wibot9']; $err_lvl = 2; } ?>