Ejemplo n.º 1
0
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
/* Squid Proxy Server realtime stats */
require_once 'guiconfig.inc';
require_once 'sqstat.class.php';
// init
$squidclass = new squidstat();
/*
 * Requests
 */
/* AJAX response */
if ($_REQUEST['getactivity']) {
    header("Content-type: text/javascript");
    echo sqstat_AJAX_response($_REQUEST);
    exit;
}
/*
 * HTML Page
 */
$pgtitle = "Squid Proxy Server: Realtime Stats (SQStat)";
require_once "head.inc";
$csrf_token = csrf_get_tokens();
Ejemplo n.º 2
0
<?php

/*               *** sqstat - Squid Proxy Server realtime stat ***
(c) Alex Samorukov, samm@os2.kiev.ua
*/
error_reporting(E_ALL);
DEFINE("SQSTAT_VERSION", "1.20");
// loading sqstat class
include_once "sqstat.class.php";
$squidclass = new squidstat();
// loading configuration
if (is_file("config.inc.php")) {
    include_once "config.inc.php";
    // checking configuration. We need to have at least one
    // squidhost/squid pair
    if (!isset($_GET["config"])) {
        $config = 0;
    } else {
        $config = (int) $_GET["config"];
    }
    if (!isset($squidhost[$config]) || !isset($squidport[$config])) {
        $squidclass->errno = 4;
        $squidclass->errstr = "Error in the configuration file." . 'Please, specify $squidhost[' . $config . ']/$squidport[' . $config . ']';
        $squidclass->showError();
        exit(4);
    }
    for ($i = 0; $i < count($squidhost); $i++) {
        $configs[$i] = $squidhost[$i] . ':' . $squidport[$i];
    }
    @($squidhost = $squidhost[$config]);
    @($squidport = $squidport[$config]);