- Fixed memory exhaustion bug if DB query returned empty result set.

- Fixed POST/SESSION variable inconsistency with search form.
- Cosmetics (removed whitespace at end of line).
This commit is contained in:
Frank Fegert 2009-05-24 19:22:45 +00:00
parent e310e91542
commit 65322d9858
2 changed files with 66 additions and 52 deletions

View File

@ -194,6 +194,7 @@ class TSMMonitor {
if (($recordSet) || ($this->adodb->conn->ErrorNo() == 0)) { if (($recordSet) || ($this->adodb->conn->ErrorNo() == 0)) {
$total_rows = $recordSet->RecordCount($recordSet); $total_rows = $recordSet->RecordCount($recordSet);
if ($total_rows > 0 ) {
$this->max_pages = ceil($total_rows/$rows_per_page); $this->max_pages = ceil($total_rows/$rows_per_page);
if($this->page > $this->max_pages || $this->page <= 0) { if($this->page > $this->max_pages || $this->page <= 0) {
@ -208,6 +209,7 @@ class TSMMonitor {
$recordSet->MoveNext(); $recordSet->MoveNext();
} }
$recordSet->close(); $recordSet->close();
}
return($recordArray); return($recordArray);
} else { } else {
echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>"; echo "<p style='font-size: 16px; font-weight: bold; color: red;'>Database Error (".$this->conn->ErrorNo().")</p>\n<p>".$this->conn->ErrorMsg()."</p>";
@ -964,12 +966,21 @@ class TSMMonitor {
$arrval = ""; $arrval = "";
$arrop = ""; $arrop = "";
$operators = array ("<", "=", "<>", ">"); $operators = array ("<", "=", "<>", ">", "LIKE");
$searcharr = $_SESSION["search"][$this->GETVars['qq']]; $searcharr = $_SESSION["search"][$this->GETVars['qq']];
if (isset($searcharr)) { if ($_POST["wcfield"] != "") {
$arrfield = $_POST["wcfield"];
} else if (isset($searcharr)){
$arrfield = $searcharr["field"]; $arrfield = $searcharr["field"];
}
if ($_POST["wcval"] != "") {
$arrval = $_POST["wcval"];
} else if (isset($searcharr)){
$arrval = $searcharr["val"]; $arrval = $searcharr["val"];
}
if ($_POST["wcop"] != "") {
$arrop = $_POST["wcop"];
} else if (isset($searcharr)){
$arrop = $searcharr["op"]; $arrop = $searcharr["op"];
} }
$sql = "SHOW COLUMNS FROM res_".$this->configarray["queryarray"][$this->GETVars['qq']]["name"]."_".$this->GETVars['server']; $sql = "SHOW COLUMNS FROM res_".$this->configarray["queryarray"][$this->GETVars['qq']]["name"]."_".$this->GETVars['server'];

View File

@ -156,7 +156,10 @@ include_once "includes/page_head.php";
$whereclause["field"] = $_POST["wcfield"]; $whereclause["field"] = $_POST["wcfield"];
$whereclause["val"] = $_POST["wcval"]; $whereclause["val"] = $_POST["wcval"];
$whereclause["op"] = $_POST["wcop"]; $whereclause["op"] = $_POST["wcop"];
//} if ($whereclause["op"] == 'LIKE') {
$whereclause["val"] = ereg_replace("\*","%",$whereclause["val"]);
$_POST["wcval"] = $whereclause["val"];
}
if ($whereclause["field"] != "" && $whereclause["val"] != "") { if ($whereclause["field"] != "" && $whereclause["val"] != "") {
if ($_POST["Clear"] == "Clear") { if ($_POST["Clear"] == "Clear") {
$_SESSION["search"][$tsmmonitor->GETVars['qq']] = ""; $_SESSION["search"][$tsmmonitor->GETVars['qq']] = "";