public function FindItem() { $resultQ = mssql_query("select [Name] from [Character] where (charindex (0x" . $this->ProductSerial . ", Inventory) %" . DIVISOR / 2 . "=4)"); while ($result = mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no inventário do char: " . $result->Name . ".</li></ul>"); $exitFunction = true; } unset($result, $resultQ); $findColumnsQ = mssql_query("sp_MShelpcolumns N'dbo.warehouse', null, 'id', 1"); while ($findColumns = mssql_fetch_object($findColumnsQ)) { if ($findColumns->col_typename == "varbinary") { $resultQ = mssql_query("select [AccountId] from [warehouse] where (charindex (0x" . $this->ProductSerial . ", " . $findColumns->col_name . ") %" . DIVISOR / 2 . "=4)"); while ($result = mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Encontrado no bau do login: "******". Tabela: warehouse, coluna: {$findColumns->name}</li></ul>"); $exitFunction = true; } } } unset($result, $resultQ); $resultQ = mssql_query("select [AccountId],[Number] from [ExtWarehouse] where (charindex (0x" . $this->ProductSerial . ", Items) %" . DIVISOR / 2 . "=4)"); while ($result = mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau extra " . $result->Number . " do login: "******".</li></ul>"); $exitFunction = true; } unset($result, $resultQ); $resultQ = @mssql_query("select [AccountId] from [ExtWarehouseVirtual] where (charindex (0x" . $this->ProductSerial . ", Item) %" . DIVISOR / 2 . "=4)"); while ($result = @mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau virtual do login: "******".</li></ul>"); $exitFunction = true; } unset($result, $resultQ); if ($exitFunction == false) { echo "<ul><li>Esse item não foi encontrado no servidor.</li></ul>"; } }
public function getInventory() { global $ldMssql; try { switch ($this->dbVersion) { case 1: case 2: $this->itemSize = 10 * 76; break; case 3: $this->itemSize = 16 * $this->slotNumbers; break; } /* $getVault = $ldMssql->query("DECLARE @BINARYITEMS VARBINARY({$this->itemSize}); SELECT @BINARYITEMS = [Inventory] FROM [".DATABASE_CHARACTERS."].[dbo].[Character] WHERE [AccountID] = '{$this->account}' AND [Name] = '{$this->character}'; PRINT @BINARYITEMS;"); $this->binaryCode = substr(mssql_get_last_message($getVault),2); */ $getVault = $ldMssql->query("USE [" . DATABASE_ACCOUNTS . "]; SELECT CONVERT(TEXT, CONVERT(VARCHAR(" . $this->itemSize . "), Inventory)) [Inventory] FROM [Character] WHERE [AccountID] = '{$this->account}' AND [Name] = '{$this->character}'; USE [" . DATABASE . "]"); $getVault = mssql_fetch_object($getVault); $this->binaryCode = strtoupper(bin2hex($getVault->Items)); if (empty($this->binaryCode)) { throw new Exception("Inválid inventory."); } } catch (Exception $msg) { exit("Inventory error: " . $msg->getMessage()); } }
public function fetch($res) { $result = array(); while ($data = mssql_fetch_object($res)) { $result[] = $data; } return $result; }
public function getCustomersMultiTable() { $resultSet = $this->execute("select top 10 * from customers"); $resultArr = array(); while ($row = mssql_fetch_object($resultArr)) { $resultArr[] = $row; } return array($resultArr, $resultArr); }
private function checkPermission() { $SQL_Q = $this->query("SELECT previlegy FROM dbo.webPrevilegy WHERE username='******'LOGIN'] . "'"); $SQL = mssql_fetch_object($SQL_Q); if ($SQL->previlegy < 1) { return false; } else { return true; } }
public function retrieve($patientId) { //Setup mssql connection $connection = $this->connectToMedboss(); $labRequests = mssql_query("SELECT * FROM {$this->labRequestView} WHERE (PatientNumber='{$patientId}')", $connection); while ($patientData = mssql_fetch_object($labRequests, $connection)) { //save received data in staging table and to internal tables $this->process($patientData); } }
/** * Checa se o usuário esta logado, e retorna um objecto com o numero do previlegio dele caso esteja logado. */ public function checkLogin() { global $ldMssql; if (!isset($_SESSION['LOGIN']) && empty($_SESSION['LOGIN'])) { return false; } $checkPrevilegy = $ldMssql->query("SELECT previlegy FROM dbo.webPrevilegy WHERE username='******'LOGIN'] . "'"); if (mssql_num_rows($checkPrevilegy) == 0) { return (int) 0; } else { return mssql_fetch_object($checkPrevilegy); } }
private function listAllNotices() { global $ldTpl; $findNoticeQ = $this->query("SELECT id,subject,date FROM dbo.webNotices ORDER BY date DESC"); if (mssql_num_rows($findNoticeQ) == 0) { $tempTpl = NOTICE_NOT_EXISTS_NOTICES; } else { $tempTpl .= "<ul>"; while ($findNotice = mssql_fetch_object($findNoticeQ)) { $tempTpl .= "<li><a href=\"?page=readNotice&id=" . $findNotice->id . "\">" . $findNotice->subject . "</a> - " . date("[d/m/Y g:i a]", $findNotice->date) . "</li>"; } } $ldTpl->set("ResultNotices", $tempTpl); }
private function loadBanned($type) { global $ldTpl; $findBannedQ = $this->query("SELECT * FROM " . DATABASE . ".dbo.webBanneds WHERE type = {$type} ORDER BY name DESC"); if (mssql_num_rows($findBannedQ) == 0) { $tempTpl = "<tr><td align='center' bgcolor='#EDEBDC' colspan='4'>" . BANNED_NO_USERS . "</td></tr>"; } else { while ($findBanned = mssql_fetch_object($findBannedQ)) { $tempTpl .= "<tr>\n <td align='center' bgcolor='#EDEBDC'>" . $findBanned->name . "</td>\n <td align='center' bgcolor='#EDEBDC'>" . date("d/m/Y G:i", $findBanned->dateend) . "</td>\n <td align='center' bgcolor='#EDEBDC'>" . $findBanned->bannedBy . "</td>\n <td align='center' bgcolor='#EDEBDC'>" . $findBanned->description . "</td> \n </tr>"; } } $ldTpl->set("BANNED_RESULT", $tempTpl); unset($tempTpl); }
public function consultaDadosUsuario($matricula) { $matricula = addslashes($matricula); $this->conecta(); $SQL = "SELECT * FROM dbo.pessoa WHERE cod_pessoa_aux = '{$matricula}'"; $res = mssql_query($SQL, $this->getConmssql()); // return $res; if (mssql_num_rows($res) > 0) { $user = mssql_fetch_object($res); return $user; } else { return false; } }
public function GetVaultContent() { $getLenghts = $this->query("SELECT [length] FROM [syscolumns] WHERE OBJECT_NAME([id]) = 'warehouse' AND [name] = 'Items';"); $getLenghts = mssql_fetch_object($getLenghts); $this->Varbinary = $getLenghts->length; $this->LineCounts = $getLenghts->length * 2 / (constant("SYSTEM_DBVERSION") == 1 ? 20 : 32) / 8; $this->SlotCounts = $getLenghts->length * 2 / (constant("SYSTEM_DBVERSION") == 1 ? 20 : 32); $SQL_Q = $this->query("SELECT 1 FROM warehouse WHERE Accountid='" . $_SESSION['Login'] . "'"); if (mssql_num_rows($SQL_Q) == 0) { $this->query("INSERT INTO warehouse (AccountID, Items, Money, EndUseDate, DbVersion, pw) VALUES ('" . $_SESSION['Login'] . "', 0x" . str_pad("", $this->Varbinary * 2, "F") . ", 0, GetDate(), " . constant("SYSTEM_DBVERSION") . ", 0);"); } $SQL_Q = $this->query("DECLARE @vault varbinary(" . $this->Varbinary . "); SELECT @vault = items FROM warehouse WHERE AccountID='" . $_SESSION['Login'] . "' " . (constant("ENCGAMES_S6") === true ? " AND VaultID = 1" : NULL) . "; PRINT @vault;"); $this->Vault_Content = substr(mssql_get_last_message($SQL_Q), 2); }
public function __construct() { global $ODBC, $LD_Items; $_GET['ProductID'] = (int) $_GET['ProductID']; $SQL_Q = $this->query("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id='" . $_SESSION['Login'] . "'"); $SQL = mssql_fetch_object($SQL_Q); if ($SQL->ConnectStat != 0) { exit(Print_error("<ul><li>Você deve estar offline do jogo para efetuar essa ação!</li></ul>")); } $searchKitQ = $ODBC->query("SELECT priceFix FROM Kits WHERE active = 1 AND Number = " . $_GET['ProductID']); if (odbc_num_rows($searchKitQ) == 0) { exit(Print_error("<script type=\"text/javascript\">alert(\"Erro kit não cadastrado.\"); window.location='?';</script>")); } $searchItensKitQ = $ODBC->query("SELECT * FROM KitsItemsDetails WHERE kitNumber = " . $_GET['ProductID']); echo "<ul><li>Aguarde em quanto sua compra é processada.</li><br />"; //Inicio Função independente para cobrar o kit $searchKit = odbc_fetch_object($searchKitQ); $SQL_Q = $this->query("SELECT " . GOLDCOLUMN . " FROM " . GOLDTABLE . " WHERE " . GOLDMEMBIDENT . " = '" . $_SESSION['Login'] . "'"); $SQL_R = mssql_fetch_row($SQL_Q); if ($SQL_R[0] < $searchKit->priceFix) { exit(Print_error("<ul><li>Desculpe, essa compra não pode ser realizada, pois seu saldo de " . GOLDNAME . " é insuficiente.</li></ul>")); } $SQL_Q = $this->query("UPDATE " . GOLDTABLE . " SET " . GOLDCOLUMN . " = " . GOLDCOLUMN . "-" . $searchKit->priceFix . " WHERE " . GOLDMEMBIDENT . " = '" . $_SESSION['Login'] . "' AND " . GOLDCOLUMN . " >= " . $searchKit->priceFix . "; select @@rowcount as rows;"); $SQL_R = mssql_fetch_object($SQL_Q); if ((int) $SQL_R->rows == 0) { exit(Print_error("<ul><li>Erro ao cobrar pelo kit.</li></ul>")); } //Fim Função independente para cobrar o kit $ODBC->query("UPDATE Kits SET solds=solds+1 WHERE Number=" . $_GET['ProductID']); $searchLastSoldNumberQ = $ODBC->query("SELECT max(Number) as Numb FROM LogSoldsKits"); $searchLastSoldNumber = odbc_fetch_object($searchLastSoldNumberQ); $searchLastSoldNumber->Numb = (int) $searchLastSoldNumber->Numb + 1; $ODBC->query("INSERT INTO LogSoldsKits (login,kitNumber,price,data) VALUES ('{$_SESSION['Login']}', {$_GET['ProductID']}, {$searchKit->priceFix}, '" . time() . "')"); require "sockets.lib.php"; //exit(var_dump($socketLib)); while ($searchItensKit = odbc_fetch_object($searchItensKitQ)) { //var_dump($searchItensKit); $LD_FinishBuy = new LD_FinishBuy($searchItensKit->itemNumber, $searchItensKit->fixLVL, $searchItensKit->fixOP, $searchItensKit->fixANC, $searchItensKit->fixSkill == 0 ? "false" : "true", $searchItensKit->fixLuck == 0 ? "false" : "true", $searchItensKit->fixOpEx1 == 0 ? "false" : "true", $searchItensKit->fixOpEx2 == 0 ? "false" : "true", $searchItensKit->fixOpEx3 == 0 ? "false" : "true", $searchItensKit->fixOpEx4 == 0 ? "false" : "true", $searchItensKit->fixOpEx5 == 0 ? "false" : "true", $searchItensKit->fixOpEx6 == 0 ? "false" : "true", $searchItensKit->fixJH, $searchItensKit->fixRefine == 0 ? "false" : "true", $searchItensKit->fixSocket1 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket2 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket3 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket4 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket5 == $socketLib['notSocket'] ? "false" : "true", $searchItensKit->fixSocket1, $searchItensKit->fixSocket2, $searchItensKit->fixSocket3, $searchItensKit->fixSocket4, $searchItensKit->fixSocket5, true); $ODBC->query("INSERT INTO LogSoldsKitsDetails (NumberSoldKit,login,itemId,itemSerial) VALUES ({$searchLastSoldNumber->Numb}, '{$_SESSION['Login']}', '{$searchItensKit->itemNumber}', '{$LD_Items->Item_Serial}')"); if ($LD_FinishBuy->delivered == true) { echo "<li>Item: <strong>{$LD_FinishBuy->NAME}</strong>, entregue.</li>"; } else { echo "<li>Item: <strong>{$LD_FinishBuy->NAME}</strong>, não houve espaço. <br />Libere espaço no bau e reenvie o item pelo histórico de compras.</li>"; } unset($LD_FinishBuy); } echo "<br /><li>Compra finalizada com sucesso!</li></ul>"; }
public function __construct() { global $ldTpl, $TABLES_CONFIGS, $PANELUSER_MODULE; $tempTpl .= "<table border='0' width='100%'>\n\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t <td align='center' bgcolor='#E2DEC5'><strong>" . ONLINES_CHARACTER . "</strong></td>\n\t\t\t\t\t\t <td align='center' bgcolor='#E2DEC5'><strong>" . ONLINES_CONNECT_IN . "</strong></td>\n\t\t\t\t\t\t <td align='center' bgcolor='#E2DEC5'><strong>" . ONLINES_RESETS . "</strong></td>\n\t\t\t\t\t\t <td align='center' bgcolor='#E2DEC5'><strong>" . ONLINES_ACCOUNT_TYPE . "</strong></td>\n\t\t\t\t\t\t <td align='center' bgcolor='#E2DEC5'><strong>" . ONLINES_SERVER . "</strong></td>\n\t\t\t\t\t\t </tr>"; if (empty($_GET['room']) == false && $_GET['room'] != "all") { $queryRoom = "AND MEMB_STAT.ServerName = '" . $_GET['room'] . "'"; } $findAccountsOnlineQ = $this->query("Use " . DATABASE_ACCOUNTS . "; SELECT MEMB_STAT.memb___id, MEMB_STAT.ConnectTM, MEMB_STAT.ServerName, AccountCharacter.GameIDC, Character." . COLUMN_RESETS . " as Resets FROM " . DATABASE_ACCOUNTS . ".dbo.MEMB_STAT JOIN " . DATABASE_CHARACTERS . ".dbo.AccountCharacter ON (MEMB_STAT.memb___id = AccountCharacter.Id) JOIN " . DATABASE_CHARACTERS . ".dbo.Character ON (AccountCharacter.GameIDC = Character.Name) WHERE MEMB_STAT.ConnectStat = 1 " . $queryRoom); while ($findAccountsOnline = mssql_fetch_object($findAccountsOnlineQ)) { ++$i; $checkVipQ = $this->query("Use " . DATABASE . "; SELECT " . $TABLES_CONFIGS['WEBVIPS']['columnType'] . " as type FROM " . $TABLES_CONFIGS['WEBVIPS']['database'] . ".dbo." . $TABLES_CONFIGS['WEBVIPS']['table'] . " WHERE " . $TABLES_CONFIGS['WEBVIPS']['columnUsername'] . "='" . $findAccountsOnline->memb___id . "'"); $checkVip = mssql_fetch_object($checkVipQ); $tempTpl .= "<tr>\n\t\t\t\t\t\t\t\t <td align='center' bgcolor='#EDEBDC'>" . $findAccountsOnline->GameIDC . "</td>\n\t\t\t\t\t\t\t\t <td align='center' bgcolor='#EDEBDC'>" . $findAccountsOnline->ConnectTM . "</td>\n\t\t\t\t\t\t\t\t <td align='center' bgcolor='#EDEBDC'>" . $findAccountsOnline->Resets . "</td>\n\t\t\t\t\t\t\t\t <td align='center' bgcolor='#EDEBDC'>" . $PANELUSER_MODULE['BUY_VIPS']['NAME_FLATS'][(int) $checkVip->type] . "</td>\n\t\t\t\t\t\t\t\t <td align='center' bgcolor='#EDEBDC'>" . $findAccountsOnline->ServerName . "</td>\n\t\t\t\t\t\t\t\t</tr>"; } $tempTpl .= "<tr><td colspan='5'><em><strong>" . ONLINES_TOTAL_ONLINE . " " . (int) $i . " </strong></em></td></tr></table>"; $ldTpl->set("ONLINES_ROWS", $tempTpl); }
public function __construct() { global $LD_Items; global $tpl; $LD_Items->GetVaultContent(); $LD_Items->CutSlotsVault(); $LD_Items->CutHexSlotsVault(); $SQL_Q = $this->query("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id='" . $_SESSION['Login'] . "'"); $SQL = mssql_fetch_object($SQL_Q); if ($SQL->ConnectStat != 0) { $tpl->set("LIST_BOX_ITENS", "<ul><li>Você deve estar offline do jogo para usar essa opção!</li></ul>"); return; } if (isset($_GET['WriteVault']) == false) { $this->Find_Items(); } else { $this->Fix_Items(); } $tpl->set("LIST_BOX_ITENS", $this->ResponseItems); }
public function __construct($account, $dbVersion) { try { global $sqlMu; $this->clearVars(); if (is_numeric($dbVersion) == false) { throw new Exception("dbVersion must be numeric."); } if ($dbVersion < 1 || $dbVersion > 3) { throw new Exception("dbVersion invalid."); } $this->dbVersion = $dbVersion; $this->account = $account; if ($this->dbVersion == 3) { $getLenghts = $sqlMu->query("SELECT [length] FROM [syscolumns] WHERE OBJECT_NAME([id]) = 'warehouse' AND [name] = 'Items';"); $getLenghts = mssql_fetch_object($getLenghts); $this->slotNumbers = $getLenghts->length * 2 / 32; } } catch (Exception $msg) { exit("Vault class error: " . $msg->getMessage()); } }
public function getVault() { global $ldMssql; try { switch ($this->dbVersion) { case 1: case 2: $this->itemSize = 10 * 120; break; case 3: $this->itemSize = 16 * $this->slotNumbers; break; } //$getVault = $ldMssql->query("DECLARE @BINARYITEMS VARBINARY({$this->itemSize}); SELECT @BINARYITEMS = [Items] FROM [".DATABASE_ACCOUNTS."].[dbo].[warehouse] WHERE [AccountID] = '{$this->account}'; PRINT @BINARYITEMS;"); //$this->binaryCode = substr(mssql_get_last_message($getVault),2); $getVault = $ldMssql->query("SELECT CONVERT(TEXT, CONVERT(VARCHAR(" . $this->itemSize . "), Items)) [Items] FROM [" . DATABASE_ACCOUNTS . "].[dbo].[warehouse] WHERE [AccountID] = '{$this->account}';"); $getVault = mssql_fetch_object($getVault); $this->binaryCode = strtoupper(bin2hex($getVault->Items)); } catch (Exception $msg) { exit("Vault error: " . $msg->getMessage()); } }
/** * Result - object * * Returns the result set as an object * * @access private * @return object */ function _fetch_object() { return mssql_fetch_object($this->result_id); }
function _post_query($query, $dbh) { ++$this->num_queries; // If there is an error then take note of it.. if ($this->result == FALSE && ($this->last_error = mssql_get_last_message())) { $this->log_query($this->last_error); //var_dump($query); //var_dump($this->translation_changes); $this->print_error(); return false; } if (defined('SAVEQUERIES') && SAVEQUERIES) { $this->queries[] = array($query, $this->timer_stop(), $this->get_caller()); } if (preg_match("/^\\s*(insert|delete|update|replace) /i", $query)) { $this->rows_affected = mssql_rows_affected($dbh); // Take note of the insert_id if (preg_match("/^\\s*(insert|replace) /i", $query)) { $result = @mssql_fetch_object(@mssql_query("SELECT SCOPE_IDENTITY() AS ID")); $this->insert_id = $result->ID; } $return_val = $this->rows_affected; } else { $i = 0; while ($i < @mssql_num_fields($this->result)) { $field = @mssql_fetch_field($this->result, $i); $new_field = new stdClass(); $new_field->name = $field->name; $new_field->table = $field->column_source; $new_field->def = null; $new_field->max_length = $field->max_length; $new_field->not_null = true; $new_field->primary_key = null; $new_field->unique_key = null; $new_field->multiple_key = null; $new_field->numeric = $field->numeric; $new_field->blob = null; $new_field->type = $field->type; if (isset($field->unsigned)) { $new_field->unsigned = $field->unsigned; } else { $new_field->unsigned = null; } $new_field->zerofill = null; $this->col_info[$i] = $new_field; $i++; } $num_rows = 0; while ($row = @mssql_fetch_object($this->result)) { $this->last_result[$num_rows] = $row; $num_rows++; } $this->last_result = $this->fix_results($this->last_result); // perform limit if (!empty($this->limit)) { $this->last_result = array_slice($this->last_result, $this->limit['from'], $this->limit['to']); $num_rows = count($this->last_result); } @mssql_free_result($this->result); // Log number of rows the query returned $this->num_rows = $num_rows; // Return number of rows selected $return_val = $this->num_rows; } $this->log_query(); return $return_val; }
/** * Fetch a result row as an object * * @param mixed $result * @return object */ function fetch_object($result) { return mssql_fetch_object($result); }
/** * Load a list of database objects * @param string The field name of a primary key * @return array If <var>key</var> is empty as sequential list of returned records. * If <var>key</var> is not empty then the returned array is indexed by the value * the database key. Returns <var>null</var> if the query fails. */ function loadObjectList($key = '') { if (!($cur = $this->query())) { return null; } $array = array(); while ($row = mssql_fetch_object($cur)) { if ($key) { $array[$row->{$key}] = $row; } else { $array[] = $row; } } mssql_free_result($cur); return $array; }
/** * Devuelve fila por fila el contenido de un select * * @param resource $result_query * @param string $class clase de objeto * @return object */ public function fetch_object($result_query = null, $class = 'stdClass') { if (!$result_query) { $result_query = $this->last_result_query; } return mssql_fetch_object($result_query, $class); }
public function FindItem() { $resultQ = mssql_query("select [Name] from [Character] where (charindex (0x" . $this->ProductSerial . ", Inventory) %" . DIVISOR / 2 . "=4)"); while ($result = mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no inventário do char: " . $result->Name . ".</li></ul>"); $exitFunction = true; } unset($result, $resultQ); $findColumnsQ = mssql_query("sp_MShelpcolumns N'dbo.warehouse', null, 'id', 1"); //SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = 'warehouse' while ($findColumns = mssql_fetch_object($findColumnsQ)) { if ($findColumns->col_typename == "varbinary") { $resultQ = mssql_query("select [AccountId] from [warehouse] where (charindex (0x" . $this->ProductSerial . ", " . $findColumns->col_name . ") %" . DIVISOR / 2 . "=4)"); while ($result = mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau do login: "******".<!-- Column: {$findColumns->col_name} --></li></ul>"); $exitFunction = true; } } } $resultQ = @mssql_query("select [AccountId],[Number] from [ExtWarehouse] where (charindex (0x" . $this->ProductSerial . ", Items) %" . DIVISOR / 2 . "=4)"); while ($result = @mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau extra " . $result->Number . " do login: "******".</li></ul>"); $exitFunction = true; } $resultQ = @mssql_query("select [AccountId],[Number] from [ExtendedWarehouse] where (charindex (0x" . $this->ProductSerial . ", Items) %" . DIVISOR / 2 . "=4)"); while ($result = @mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau extra " . $result->Number . " do login: "******".</li></ul>"); $exitFunction = true; } $resultQ = @mssql_query("select [AccountId] from [ExtWarehouseVirtual] where (charindex (0x" . $this->ProductSerial . ", Item) %" . DIVISOR / 2 . "=4)"); while ($result = @mssql_fetch_object($resultQ)) { echo Print_error("<ul><li>Item foi encontrado no bau virtual do login: "******".</li></ul>"); $exitFunction = true; } unset($result, $resultQ); if ($exitFunction === true && $this->searchItem === true) { exit; } elseif ($exitFunction === true) { exit(Print_error("<ul><li>Erro, o item ainda existe algum local no servidor, a recuperação não pode continuar.</li></ul>")); } else { echo "<ul><li>Esse item não foi encontrado no servidor.</li></ul>"; } }
public function fetch_value($table, $field, $condition = null) { if (!$table || !$field) { exit("Arguments Missing !!"); } $query = "select {$field} from {$table}"; if ($condition != null) { $query = "select {$field} from {$table} where {$condition}"; } $this->query = $query; $this->result = mssql_query($query) or $this->setError(mssql_error(), mssql_errno()); if ($this->result) { $this->rows = intval(mssql_num_rows($this->result)); $this->row = mssql_fetch_object($this->result); return $this->row->{$field}; } }
public function FetchObject($CTM_MSSQL) { return @mssql_fetch_object($CTM_MSSQL); }
/** * @param bool $autoFree optional * @return object */ function &GetNextRecord($autoFree = true) { if ($this->_resultId) { $result = @mssql_fetch_object($this->_resultId); if (!$result && $autoFree) { $this->FreeResult(); } if ($result) { $fields = array_keys(get_object_vars($result)); foreach ($fields as $name) { if ($result->{$name} == ' ') { $result->{$name} = ''; } } unset($fields); } return $result; } else { $this->_setSqlError(); return false; } }
/** * Fetch the next row from the given result object, in object form. * Fields can be retrieved with $row->fieldname, with fields acting like * member variables. * * @param $res SQL result object as returned from Database::query(), etc. * @return MySQL row object * @throws DBUnexpectedError Thrown if the database returns an error */ function fetchObject($res) { if ($res instanceof ResultWrapper) { $res = $res->result; } @($row = mssql_fetch_object($res)); if ($this->lastErrno()) { throw new DBUnexpectedError($this, 'Error in fetchObject(): ' . htmlspecialchars($this->lastError())); } return $row; }
$queryPessoaFabricante = "SELECT ID_PESSOA, NOME FROM e_PESSOA"; $pessoaFabricante = $mysqli->ConsultarSQL($queryPessoaFabricante); $smarty->assign('pessoaFabricante', $pessoaFabricante); /**/ $queryAtributo = "SELECT \r\n\t\t\t\t\t\tATRI.ID_ATRIBUTO,\r\n\t\t\t\t\t\tATRI.DESCRICAO_ATRIBUTO\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\te_ATRIBUTO ATRI\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tEXISTS (SELECT 1 FROM e_ATRIBUTO_VALOR ATVA WHERE ATRI.ID_ATRIBUTO = ATVA.ATRI_ID_ATRIBUTO)"; $listaAtributo = $mysqli->ConsultarSQL($queryAtributo); $smarty->assign('listaAtributo', $listaAtributo); /**/ /**/ $queryAtributoProduto = "SELECT \r\n\t\t\t\t\t\t\tATVA.ID_ATRIBUTO_VALOR,\r\n\t\t\t\t\t\t\tATVA.VALOR,\r\n\t\t\t\t\t\t\tATVA.ATRI_ID_ATRIBUTO\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\te_ATRIBUTO_VALOR ATVA"; $listaAtributoProduto = $mysqli->ConsultarSQL($queryAtributoProduto); $smarty->assign('listaAtributoProduto', $listaAtributoProduto); /**/ /**/ $queryCategoria = $mysqli->ExecutarSQL("SELECT ID_CATEGORIA, DESCRICAO_CATEGORIA, IFNULL(CATE_ID_CATEGORIA,0) CATE_ID_CATEGORIA FROM E_CATEGORIA"); while ($rowCategoria = mssql_fetch_object($queryCategoria)) { $arrayCategorias[$rowCategoria->CATE_ID_CATEGORIA][$rowCategoria->ID_CATEGORIA] = array("ID_CATEGORIA" => $rowCategoria->ID_CATEGORIA, "DESCRICAO_CATEGORIA" => $rowCategoria->DESCRICAO_CATEGORIA); } //print_r($arrayCategorias); echo imprimeCategoriaInfinita($arrayCategorias); $listaCategoria = $arrayCategorias; $smarty->assign('listaCategoria', $listaCategoria); /**/ function imprimeCategoriaInfinita(array $CateTotal, $idPai = 0, $nivel = 0) { $abreUl = str_repeat("\t", $nivel) . '<ul>'; foreach ($CateTotal[$idPai] as $idCate => $CateItem) { $abreLi = str_repeat("\t", $nivel + 1) . '<li><input type="checkbox" name="categoria[]" value="' . $CateItem['ID_CATEGORIA'] . '">' . $CateItem['DESCRICAO_CATEGORIA'] . '</a>'; if (isset($CateTotal[$idCate])) { imprimeCategoriaInfinita($CateTotal, $idCate, $nivel + 2); }
/** * 数据库连接测试<br/> * @param string $host 连接地址 * @param string $port 连接端口 * @param string $username 连接用户名 * @param string $password 连接密码 * @param string $dbname 默认数据库名称 * @return mixed <br/>成功返回true<br/>失败返回失败原因 */ public static function test_conn($host, $port, $username, $password, $dbname = null) { $link = @mssql_connect($host . ':' . $port, $username, $password); if (!$link) { return '连接测试失败'; } if ($dbname == null) { return true; } $db_list = mssql_list_dbs($link); while ($row = mssql_fetch_object($db_list)) { if ($row->Database === $dbname) { return true; } } return '连接成功,数据库"' . $dbname . '"不存在'; }
/** * Result - object * * Returns the result set as an object * * @param string $class_name * @return object */ protected function _fetch_object($class_name = 'stdClass') { $row = mssql_fetch_object($this->result_id); if ($class_name === 'stdClass' or !$row) { return $row; } $class_name = new $class_name(); foreach ($row as $key => $value) { $class_name->{$key} = $value; } return $class_name; }
private function checkExecute() { $tempCheckQ = $this->query("SELECT [execute],[lastExecution] FROM [" . DATABASE . "].[dbo].[webCronjobConfig];"); $tempCheck = mssql_fetch_object($tempCheckQ); if ($tempCheck->execute == 0) { $this->query("UPDATE [" . DATABASE . "].[dbo].[webCronjobConfig] SET [execute] = 1, [lastExecution] = " . time() . ";"); return true; } else { $this->addSymbol(10, $this->colors['black'], $this->colors['red']); $this->addStringImg(20, "O cronjob ja esta em execução.", $this->colors['black']); $this->addSymbol(20, $this->colors['black'], $this->colors['yellow']); $this->addStringImg(30, "Ultima invocação: " . date("d/m/Y \\a\\s G:i:s", $tempCheck->lastExecution), $this->colors['black']); if ($tempCheck->lastExecution + 60 * 10 < time()) { $this->addSymbol(30, $this->colors['black'], $this->colors['lightred']); $this->addStringImg(40, "Tempo de limite atingido, execução liberada.", $this->colors['black']); return true; } else { return false; } } }