$sXML = ""; foreach ($_POST as $sKey => $sValue) { if (strncmp($sKey, "_", 1) != 0) { $sXML .= "<arg id=\"" . trim($sKey) . "\">" . trim(htmlspecialchars($sValue)) . "</arg>"; } } foreach ($_GET as $sKey => $sValue) { if (strncmp($sKey, "_", 1) != 0) { if (!isset($_POST[$sKey])) { $sXML .= "<arg id=\"" . trim($sKey) . "\">" . trim(htmlspecialchars($sValue)) . "</arg>"; } } } $sXML = "<args>" . $sXML . "</args>"; $oPending = new CRowtblpending(); $oPending->SetGroupId($nCommandGroup); $oPending->SetInTimestamp(date("Y-m-d H:i:s")); $oPending->SetInXML($sXML); $oPending->SetSource(0); $oPending->SetCompleted(2); $bError = !$oPending->Insert($oSession); if ($bError) { $sMessage = "<error><message>" . $oPending->GetErrorInfo() . "</message></error>"; } else { $nKey = $oPending->GetPendingId(); $nSleep = 0; do { if ($nSleep > 0) { sleep(1); } $oPending->Clear();
function Select($p_oSession) { $this->m_nError = $this->m_nDBO_OK; $bFirst = true; $this->m_bBof = true; $this->m_bEof = true; if ($p_oSession->GetFileRead()) { $oFile = @fopen($p_oSession->GetDatabase() . $this->m_sTABLE_NAME . ".dat", "r"); if ($oFile == 0) { $this->m_nError = $this->m_nDBO_BAD_READ_FILE; $this->m_sErrorInfo = $this->m_sTABLE_NAME . ".dat"; return false; } while (!feof($oFile)) { if ($this->ReadRecord($oFile, $p_oSession, $sData)) { if ($this->MatchCriteria($sData, false)) { if ($bFirst) { $this->m_oTable = array(); $bFirst = false; $this->m_bBof = false; $this->m_bEof = false; } $oObj = new CRowtblpending(); if ($sData[0] != "") { $oObj->SetPendingId($sData[0]); } if ($sData[1] != "") { $oObj->SetGroupId($sData[1]); } if ($sData[2] != "") { $oObj->SetInTimestamp($sData[2]); } if ($sData[3] != "") { $oObj->SetSource($sData[3]); } if ($sData[4] != "") { $oObj->SetInXML($sData[4]); } if ($sData[5] != "") { $oObj->SetCompleted($sData[5]); } array_push($this->m_oTable, $oObj); } } } if (!$bFirst) { reset($this->m_oTable); $oRow = current($this->m_oTable); if ($sData[0] != "") { $this->m_nPendingId = $oRow->GetPendingId(); } if ($sData[1] != "") { $this->m_nGroupId = $oRow->GetGroupId(); } if ($sData[2] != "") { $this->m_dInTimestamp = $oRow->GetInTimestamp(); } if ($sData[3] != "") { $this->m_nSource = $oRow->GetSource(); } if ($sData[4] != "") { $this->m_sInXML = $oRow->GetInXML(); } if ($sData[5] != "") { $this->m_nCompleted = $oRow->GetCompleted(); } } fclose($oFile); } else { $sSql = "SELECT * FROM " . $this->m_sTABLE_NAME; if ($this->GenerateWhereClause($p_oSession, false, $sWhere)) { $sSql .= $sWhere; } else { $this->m_nError = $this->m_nDBO_DATATYPE; $this->m_sErrorInfo = $sWhere; return false; } if (strlen($this->m_sSortBy)) { $sSql .= " ORDER BY " . $this->m_sSortBy; } if ($this->m_nFromRecord != 0) { $sSql .= " LIMIT " . $this->m_nFromRecord . "," . $this->m_nMaxRecords; } else { if ($this->m_nMaxRecords != -1) { $sSql .= " LIMIT " . $this->m_nMaxRecords; } } if (!$this->CheckSession($p_oSession)) { $this->m_nError = $this->m_nDBO_BAD_SESSION; return false; } else { if (!($oResult = mysql_query($sSql, $p_oSession->GetLink()))) { $this->m_nError = $this->m_nDBO_SELECT_FAILURE; $this->m_sErrorInfo = mysql_error() . ":" . $sSql; return false; } else { while ($oRow = mysql_fetch_object($oResult)) { $oObj = new CRowtblpending(); if ($bFirst) { $this->m_oTable = array(); if (!is_null($oRow->PendingId)) { $this->m_nPendingId = $oRow->PendingId; } if (!is_null($oRow->GroupId)) { $this->m_nGroupId = $oRow->GroupId; } if (!is_null($oRow->InTimestamp)) { $this->m_dInTimestamp = $oRow->InTimestamp; } if (!is_null($oRow->Source)) { $this->m_nSource = $oRow->Source; } if (!is_null($oRow->InXML)) { $this->m_sInXML = $oRow->InXML; } if (!is_null($oRow->Completed)) { $this->m_nCompleted = $oRow->Completed; } $bFirst = false; $this->m_bBof = false; $this->m_bEof = false; } if (!is_null($oRow->PendingId)) { $oObj->SetPendingId($oRow->PendingId); } if (!is_null($oRow->GroupId)) { $oObj->SetGroupId($oRow->GroupId); } if (!is_null($oRow->InTimestamp)) { $oObj->SetInTimestamp($oRow->InTimestamp); } if (!is_null($oRow->Source)) { $oObj->SetSource($oRow->Source); } if (!is_null($oRow->InXML)) { $oObj->SetInXML($oRow->InXML); } if (!is_null($oRow->Completed)) { $oObj->SetCompleted($oRow->Completed); } array_push($this->m_oTable, $oObj); } mysql_free_result($oResult); } } } return true; }