$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;
        }
    }
}
$sError = "<error>" . $nError . "</error>";
echo $sError;
exit;
//#######################################################################
//## Funkcije
//#######################################################################
//#######################################################################
//##  Request($sParameterName)
//#######################################################################
function Request($sParameterName)
function moneta_link($params)
{
    # Gateway Specific Variables
    //    $gatewayusername = $params['username'];
    //    $gatewaytestmode = $params['testmode'];
    //    $returnurl = $params['returnurl'];
    # Invoice Variables
    $invoiceid = $params['invoiceid'];
    $description = $params["description"];
    $amount = $params['amount'];
    # Format: ##.##
    $currency = $params['currency'];
    # Currency Code
    # Client Variables
    $firstname = $params['clientdetails']['firstname'];
    $lastname = $params['clientdetails']['lastname'];
    $email = $params['clientdetails']['email'];
    $address1 = $params['clientdetails']['address1'];
    $address2 = $params['clientdetails']['address2'];
    $city = $params['clientdetails']['city'];
    $state = $params['clientdetails']['state'];
    $postcode = $params['clientdetails']['postcode'];
    $country = $params['clientdetails']['country'];
    $phone = $params['clientdetails']['phonenumber'];
    # System Variables
    $companyname = $params['companyname'];
    $systemurl = $params['systemurl'];
    $currency = $params['currency'];
    # Enter your code submit to the gateway...
    // Create Moneta XML
    $sXMLDataX = moneta_MakeOrderLine($description, $amount, 0, 1, 'kos', $invoiceid);
    $sXMLData = moneta_MakeOrderHead('', $firstname, $lastname, $companyname, $address1, '', $postcode, $city, $country, $phone, $email, $amount, $invoiceid);
    $sXMLData = $sXMLData . $sXMLDataX;
    $sXMLData = $sXMLData . moneta_MakeOrderEnd();
    $callbackUrl = MONETA_CALLBACK_URL . "?confirmationId=" . $invoiceid;
    // fetch moneta user url from database
    $monetaUserUrl = moneta_getrow("SELECT * FROM tblpaymentgateways where gateway = 'moneta' AND setting = 'userMonetaUrl'");
    $monetaUserUrl = $monetaUserUrl["value"];
    // check if order not already in db
    $row = moneta_getrow("SELECT confirmationid from moneta where confirmationid = '" . $invoiceid . "'");
    if (empty($row['confirmationid'])) {
        moneta_query("INSERT INTO moneta (confirmationid, startdate, purchasestatus, refreshcounter, orderxml, redirectok, redirectfail, amount, fee) values\r\n             ('" . $invoiceid . "', NOW(), 'vobdelavi', 0, '" . mysql_escape_string($sXMLData) . "', '" . $callbackUrl . "', '" . $callbackUrl . "', '" . $amount . "', 0)");
    }
    $code = '<input type="button" onclick="location.href = \'' . $monetaUserUrl . '&ConfirmationID=' . $invoiceid . '\'" value="' . MONETA_BUTTON_CAPTION . '" />';
    return $code;
}
            $sStatus = MODULE_PAYMENT_MONETA_TEXT_WAITING;
        } else {
            if ($sPurchaseState == "zavrnjeno") {
                $sStatus = MODULE_PAYMENT_MONETA_TEXT_ERROR;
            } else {
                if ($sPurchaseState == "potrjeno") {
                    $sStatus = MODULE_PAYMENT_MONETA_TEXT_SUCCED;
                    $sData = MODULE_PAYMENT_MONETA_TEXT_THANKYOU;
                    $sQuery = "update " . MODULE_PAYMENT_MONETA_TABLE_NAME . " set purchasestatus='prikazano' where confirmationid='" . $sConfirmationID . "'";
                    moneta_query($sQuery);
                }
            }
        }
    }
    $sQuery = "update " . MODULE_PAYMENT_MONETA_TABLE_NAME . " set refreshcounter=refreshcounter+1 where confirmationid='" . $sConfirmationID . "'";
    moneta_query($sQuery);
}
//#######################################################################
//## HTML
//#######################################################################
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8>">
    <title><?php 
echo TITLE;
?>
</title>
    <?php 
if ($sStatus == MODULE_PAYMENT_MONETA_TEXT_WAITING) {