diff --git a/admin.php b/admin.php
index c2d52da..a9909e0 100644
--- a/admin.php
+++ b/admin.php
@@ -77,6 +77,7 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
// show settings page
} else if ($tsmmonitor->GETVars['qq'] == "settings") {
$tmonpolld = new PollD($adodb);
+ $tmonpolld->adodb->setDebug($_SESSION["debug"]);
// If start/stop button was pressed
if ($_POST["PollDControl"] != "") {
@@ -89,55 +90,69 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
if ($tmonpolld->isEnabled()=="1") {
$polldenabled = "enabled and ".$tmonpolld->getStatus();
- $cellcolor = "green";
+ //$cellcolor = "green";
} else {
$polldenabled = "disabled";
- $cellcolor = "red";
+ //$cellcolor = "red";
}
- echo "PollD Control
";
echo "
Database Error (".$this->conn->ErrorNo().")
\n".$this->conn->ErrorMsg()."
"; - exit; + //exit; + return ""; } } diff --git a/includes/page_head.php b/includes/page_head.php index 8f2a5f8..03024b6 100644 --- a/includes/page_head.php +++ b/includes/page_head.php @@ -29,6 +29,8 @@ if ($_POST["css"] != "") $_SESSION['stylesheet'] = $_POST["css"]; if ($_POST["tabletype"] != "") $_SESSION["tabletype"] = $_POST["tabletype"]; +if ($_POST["DebugMode"] != "") $_SESSION["debug"] = $_POST["DebugMode"]; +$adodb->setDebug($_SESSION["debug"]); ?> diff --git a/includes/polld.php b/includes/polld.php index 75d4feb..f9beb2b 100644 --- a/includes/polld.php +++ b/includes/polld.php @@ -179,10 +179,10 @@ class PollD { if ($restable == "res_querysession_TSMSRV1") echo $read."\n"; $read = ereg_replace("\t","\",\"",$read); if ($restable == "res_querysession_TSMSRV1") echo $read."\n"; - if ($timestamp != '') { + if ($overviewname == '') { $out[] = 'INSERT IGNORE INTO '.$restable.' values ("'.$timestamp.'", "'.$read.'")'; } else { - $out[] = 'INSERT INTO '.$restable.' (name, result) values ("'.$overviewname.'", "'.$read.'") ON DUPLICATE KEY update result="'.$read.'"'; + $out[] = 'INSERT INTO '.$restable.' (timestamp, name, result) values ("'.$timestamp.'", "'.$overviewname.'", "'.$read.'") ON DUPLICATE KEY update result="'.$read.'"'; } } else { // result is empty and it's ok $out[0] = 'INSERT IGNORE INTO '.$restable.' (timestamp) values ("'.$timestamp.'")'; @@ -352,9 +352,9 @@ class PollD { $tablename = "res_overview_".$server["servername"]; echo "---------".$query["name"].": "; //$ctsql = "CREATE TABLE IF NOT EXISTS ".$tablename." LIKE smp_overview"; - $ctsql = "CREATE TABLE IF NOT EXISTS ".$tablename." ( `name` varchar(35) collate utf8_unicode_ci NOT NULL, `result` varchar(255) collate utf8_unicode_ci NOT NULL, UNIQUE KEY `name` (`name`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; + $ctsql = "CREATE TABLE IF NOT EXISTS ".$tablename." ( `timestamp` int(11) collate utf8_unicode_ci NOT NULL, `name` varchar(35) collate utf8_unicode_ci NOT NULL, `result` varchar(255) collate utf8_unicode_ci NOT NULL, UNIQUE KEY `name` (`name`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; $this->adodb->execDB($ctsql); - $result = $this->execute($query["query"], $server["servername"], $tablename, '', $query["name"]); + $result = $this->execute($query["query"], $server["servername"], $tablename, $timestamp, $query["name"]); if ($result != "") { foreach ($result["sql"] as $insertquery) { $this->adodb->execDB($insertquery); diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php index 3499df2..eff44b0 100644 --- a/includes/tsmmonitor.php +++ b/includes/tsmmonitor.php @@ -64,6 +64,8 @@ class TSMMonitor { $this->adodb = $adodb; + //$this->adodb->setDebug($_SESSION["debug"]); + session_name("tsmmonitordev"); session_start(); @@ -134,6 +136,7 @@ class TSMMonitor { if ($_POST["Poll"] == "Poll Now!") { $timestamp = time(); $tmonpolld = new PollD($this->adodb); + $tmonpolld->adodb->setDebug($_SESSION["debug"]); $tmonpolld->pollQuery($tmonpolld->queries[$this->GETVars['qq']], $tmonpolld->servers[$this->GETVars['server']], TRUE, $timestamp); $_SESSION['timemachine']['date'] = $timestamp; $_SESSION['timemachine']['time'] = $timestamp; @@ -315,10 +318,11 @@ class TSMMonitor { $this->queryarray = $this->configarray["queryarray"]; $ret = ""; + $qq = $this->GETVars['qq']; - if ($this->queryarray[$this->GETVars['qq']]["polltype"]=="snapshot") { + if ($this->queryarray[$qq]["polltype"]=="snapshot") { $ret .= " "; - } else if ($this->queryarray[$this->GETVars['qq']]["polltype"]=="update" || $this->queryarray[$this->GETVars['qq']]["polltype"]=="append") { - $LastTimestamp = $this->GetLastSnapshot(); - if ($LastTimestamp!="") { - $ret .= " "; - } - + } else if ($this->queryarray[$qq]["polltype"]=="update" || $this->queryarray[$qq]["polltype"]=="append" || $qq == "index") { + $ret .= " "; } - return $ret; - } @@ -456,7 +457,7 @@ class TSMMonitor { $ret = ""; $ret .= "