1<?php
2///////////////////////////////////////////////////////////////////////////////
3//
4// NagiosQL
5//
6///////////////////////////////////////////////////////////////////////////////
7//
8// (c) 2005-2020 by Martin Willisegger
9//
10// Project   : NagiosQL
11// Component : Command line visualization
12// Website   : https://sourceforge.net/projects/nagiosql/
13// Version   : 3.4.1
14// GIT Repo  : https://gitlab.com/wizonet/NagiosQL
15//
16///////////////////////////////////////////////////////////////////////////////
17//
18// Path settings
19// ===================
20$strPattern = '(admin/[^/]*.php)';
21$preRelPath  = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING));
22$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING));
23//
24// Define common variables
25// =======================
26$preNoMain        = 1;
27//
28// Include preprocessing file
29// ==========================
30require $preBasePath. 'functions/prepend_adm.php';
31$strCommandLine = '&nbsp;';
32$intCount       = 0;
33//
34// Get database values
35// ===================
36if (isset($_GET['cname']) && ($_GET['cname'] != '')) {
37    $strResult = $myDBClass->getFieldData("SELECT command_line FROM tbl_command WHERE id='".
38        filter_var($_GET['cname'], FILTER_SANITIZE_NUMBER_INT)."'");
39    if (($strResult != false) && ($strResult != '')) {
40        $strCommandLine = $strResult;
41        $intCount = substr_count($strCommandLine, 'ARG');
42        if (substr_count($strCommandLine, 'ARG8') != 0) {
43            $intCount = 8;
44        } elseif (substr_count($strCommandLine, 'ARG7') != 0) {
45            $intCount = 7;
46        } elseif (substr_count($strCommandLine, 'ARG6') != 0) {
47            $intCount = 6;
48        } elseif (substr_count($strCommandLine, 'ARG5') != 0) {
49            $intCount = 5;
50        } elseif (substr_count($strCommandLine, 'ARG4') != 0) {
51            $intCount = 4;
52        } elseif (substr_count($strCommandLine, 'ARG3') != 0) {
53            $intCount = 3;
54        } elseif (substr_count($strCommandLine, 'ARG2') != 0) {
55            $intCount = 2;
56        } elseif (substr_count($strCommandLine, 'ARG1') != 0) {
57            $intCount = 1;
58        } else {
59            $intCount = 0;
60        }
61    }
62}
63?>
64<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
65<html>
66    <head>
67        <title>Commandline</title>
68        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
69        <style type="text/css">
70            <!--
71            body {
72                font-family: Verdana, Arial, Helvetica, sans-serif;
73                font-size: 10px;
74                color: #000000;
75                background-color: #EDF5FF;
76                margin: 3px;
77                border: none;
78            }
79            -->
80        </style>
81    </head>
82    <body>
83        <?php echo $strCommandLine; ?>
84        <script type="text/javascript" language="javascript">
85            <!--
86            parent.argcount = <?php echo $intCount; ?>;
87            //-->
88        </script>
89    </body>
90</html>