function moneta_dbTableExists($tableName) { $tables = moneta_getrows("SHOW TABLES"); foreach ($tables as $table) { foreach ($table as $row) { if ($row == $tableName) { return true; } } } return false; }
<?php error_reporting(E_ALL); ini_set("display_errors", 0); require dirname(__FILE__) . "/moneta.php"; define('MODULE_PAYMENT_MONETA_TABLE_NAME', 'moneta'); $sConfirmationID = RequestString("ConfirmationID", 32); $sTarifficationError = RequestNumber("TARIFFICATIONERROR", 0, 1, 1); $sConfirmationSignature = RequestString("ConfirmationSignature", 128); $sConfirmationIDStatus = RequestString("ConfirmationIDStatus", 32); $sIP = GetServerVariable('REMOTE_ADDR'); $nError = 1; if ($sIP == "213.229.249.103" || $sIP == "213.229.249.104" || $sIP == "213.229.249.117" || 1) { $sQuery = "select confirmationid from " . MODULE_PAYMENT_MONETA_TABLE_NAME . " where purchasestatus='vobdelavi' " . "and confirmationid='" . $sConfirmationID . "'"; $lRows = -1; $query_line = moneta_getrows($sQuery); if (!empty($query_line)) { $lRows = 1; } if ($sConfirmationID != "" && $lRows == 1) { if ($sTarifficationError == "1") { $sQuery = "update " . MODULE_PAYMENT_MONETA_TABLE_NAME . " set purchasestatus='zavrnjeno' where confirmationid='{$sConfirmationID}'"; } else { $sQuery = "update " . MODULE_PAYMENT_MONETA_TABLE_NAME . " set purchasestatus='potrjeno', confirmationsignature='{$sConfirmationSignature}', confirmdate=NOW() WHERE confirmationid='{$sConfirmationID}'"; $nError = 0; } $result = moneta_query($sQuery); if (!$result) { $nError = 1; } }