Exemple #1
0
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
$boolShowThankyou = false;
$boolShowFeedbackForm = true;
$boolShowTextlengthWarn = false;
if (isset($_POST['mZabbixFeedback'])) {
    // Process feedback
    $txtFeedback = htmlentities($_POST['txtFeedback']);
    if (strlen($txtFeedback) < 30) {
        // Don't bother, type more
        $boolShowTextlengthWarn = true;
        $boolShowThankyou = false;
        $boolShowFeedbackForm = true;
    } else {
Exemple #2
0
if (!$arrSettings["promptCredentials"]) {
    // Login using supplied credentials from the config.php file
    $zabbix->login();
} else {
    // It's a hosted version, perhaps we can recover username & password from cookies?
    $zabbixApi = "";
    $zabbixUser = "";
    $zabbixPass = "";
    // Get the values
    require_once "cookies.php";
    // Populate our class
    $zabbix->setUsername($zabbixUser);
    $zabbix->setPassword($zabbixPass);
    $zabbix->setZabbixApiUrl($zabbixApi);
    // Login
    if (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
        $zabbix->login();
    }
}
//$zabbix->Login("mattias_api", "test");
if ($zabbix->isLoggedIn()) {
    // Authenticated, save cookie
    setcookie("zabbixUsername", $zabbix->getUsername(), $arrSettings["cookieExpire"]);
    setcookie("zabbixPassword", $zabbix->getPassword(), $arrSettings["cookieExpire"]);
    setcookie("zabbixApi", $zabbix->getZabbixApiUrl(), $arrSettings["cookieExpire"]);
    setcookie("zabbixAuthHash", $zabbix->getAuthToken(), $arrSettings["cookieExpire"]);
}
// "templates"
require_once "template/header.php";
if ($zabbix->isLoggedIn()) {
    // Retrieve the data in one go