本文整理汇总了PHP中sqlUpdate函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlUpdate函数的具体用法?PHP sqlUpdate怎么用?PHP sqlUpdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlUpdate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignKnown
/** assign a known asset */
function assignKnown($serviceId, $assetId)
{
$fields = array('service_id' => $serviceId, 'status' => 1, 'date_last' => time());
$db =& DB();
$sql = sqlUpdate($db, "asset", $fields, "id = ::{$assetId}::");
$db->Execute($sql);
}
示例2: user_search
function user_search($VAR)
{
if (SESS_LOGGED) {
include_once PATH_MODULES . "voip/voip.inc.php";
$db =& DB();
$v = new voip();
$fdids = $v->get_fax_dids(SESS_ACCOUNT);
#echo "<pre>".print_r($fdids,true)."</pre>";
if (is_array($fdids)) {
foreach ($fdids as $did) {
$flds['account_id'] = SESS_ACCOUNT;
$flds['site_id'] = DEFAULT_SITE;
$sql = sqlUpdate($db, "voip_fax", $flds, "dst = ::" . $did . "::");
$db->Execute($sql);
#echo $sql."<br>";
}
}
unset($db);
$VAR['voip_fax_account_id'] = SESS_ACCOUNT;
$type = "search";
$this->method["{$type}"] = split(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->search($VAR, $this, $type);
} else {
define("FORCE_REDIRECT", "?_page=account:account");
}
}
示例3: add
/** update system message */
function add($VAR)
{
@($m = $VAR['message']);
$db =& DB();
$fields = array('date_orig' => time(), 'message' => $m);
$db->Execute(sqlUpdate($db, "account_message", $fields, "id = 1"));
}
示例4: save
function save()
{
if (!is_array($this->data)) {
echo "Invalid state to save voipDID.";
return;
}
$db =& DB();
$sql = sqlUpdate($db, "voip_did", $this->data, "id=::" . $this->data['id'] . "::");
#echo $sql."<BR />";
$db->Execute($sql);
}
示例5: user_view
function user_view($VAR)
{
/* validate, update to read, and view() */
if (!SESS_LOGGED || empty($VAR['id'])) {
return false;
}
/* select id for this user */
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "email_log", "*", "id=::{$VAR['id']}:: and account_id=" . SESS_ACCOUNT));
if ($rs && $rs->RecordCount()) {
global $smarty;
$smarty->assign('email_log', $rs->fields);
if ($rs->fields['userread'] != 1) {
/* update to read */
$fields = array('userread' => 1);
$db->Execute(sqlUpdate($db, "email_log", $fields, "id = {$rs->fields['id']}"));
}
}
}
示例6: task_area
function task_area()
{
include_once PATH_MODULES . 'voip/voip.inc.php';
$db =& DB();
$didArea = new didArea();
$sql = sqlSelect($db, "voip_pool", "*", "areacode is null or areacode=0");
$rs = $db->Execute($sql);
if ($rs && $rs->RecordCount()) {
while (!$rs->EOF) {
$n = $rs->fields['npa'] . $rs->fields['nxx'] . $rs->fields['station'];
if (($area = $didArea->determineArea($rs->fields['country_code'], $n)) !== false) {
#echo "DID=".$n." has an area of $area = ".$didArea->getName($rs->fields['country_code'],$area)."<br>";
$f = array('areacode' => $db->qstr($area));
$sql = sqlUpdate($db, "voip_pool", $f, "id=" . $rs->fields['id']);
#echo "plugin_id=".$rs->fields['voip_did_plugin_id']."<br>";
#echo $sql."<br>";
$db->Execute($sql);
}
$rs->MoveNext();
}
}
}
示例7: instAdaptPathInDB
function instAdaptPathInDB(&$session, &$message)
{
$path = getParentDir($session, $session->fScriptBase);
if (empty($path)) {
$path = PATH_DELIM;
}
instUpdateMacro($session, 'base:BaseModule', $path . "index.php/", $message);
instUpdateMacro($session, 'forum:ForumModule', $path . "forum.php/", $message);
instUpdateMacro($session, 'base:ScriptBase', $path, $message);
$count = sqlUpdate($session, 'param', " text='" . $path . "css/phpwiki.css'", "pos=152", true);
if ($count == 0) {
$message .= "\n<br>+++ Parameter 152 (CSS-Datei) nicht gefunden.";
} else {
$message .= "<br>\n" . 'CSS wurde auf ' . $path . "css/phpwiki.css gesetzt. ({$count} mal)";
}
}
示例8: provision_did_new
/** provision did */
function provision_did_new($obj)
{
@($a = unserialize($obj->service['prod_attr_cart']));
$did = $a['station'];
// new or top-up?
$db =& DB();
$didrs = $db->Execute($sql = sqlSelect($db, "voip_prepaid", "id,pin,balance", "pin = ::{$did}:: AND voip_did_id is not null AND voip_did_id <> 0 "));
if ($didrs && $didrs->RecordCount() > 0) {
$new = false;
} else {
$new = true;
}
// the balance from the invoice line item (not including setup fee)
$itemid = $obj->service['invoice_item_id'];
$invoiceItem = $db->Execute(sqlSelect($db, "invoice_item", "price_base", "id = {$itemid}"));
if ($invoiceItem && $invoiceItem->RecordCount() > 0) {
$balance = $invoiceItem->fields['price_base'];
} else {
$balance = $obj->service['price'];
}
/*
echo "<BR><BR>$sql<BR><BR>";
echo $new;
echo "$".$balance;
#print_r($obj->service);
*/
if ($new) {
// include voip plugin and provision the did
include_once PATH_PLUGINS . 'product/VOIP.php';
$voip = new plgn_prov_VOIP();
if (!$voip->p_one($obj->service_id)) {
return false;
}
# create the prepaid record
$didrs = $db->Execute(sqlSelect($db, "voip_did", "id,did", "service_id = ::{$obj->service_id}::"));
if ($didrs && $didrs->RecordCount() > 0) {
$fields = array('account_id' => $obj->account['id'], 'product_id' => $obj->service['product_id'], 'voip_did_id' => $didrs->fields['id'], 'pin' => $didrs->fields['did'], 'balance' => $balance, 'in_use' => 0);
$pin_id = sqlGenID($db, "voip_prepaid");
$sql = sqlInsert($db, "voip_prepaid", $fields, $pin_id);
$rs = $db->Execute($sql);
return true;
} else {
return false;
}
} else {
# top-up the prepaid balance
$fields = array('balance' => $balance + $didrs->fields['balance']);
$db->Execute($sql = sqlUpdate($db, "voip_prepaid", $fields, "id = {$didrs->fields['id']}"));
return true;
}
return true;
}
示例9: add_cart_discount
/**
* Add a discount at the cart/checkout by user/admin
*
* @param array $VAR
* @return bool
*/
function add_cart_discount($VAR)
{
global $C_debug, $C_translate, $smarty;
# Validate input
if (empty($VAR["discount"])) {
$C_debug->alert($C_translate->translate('invalid_discount', 'checkout', ''));
return false;
}
$discount_code = $VAR["discount"];
# Check the supplied discount
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "discount", "*", "( date_start IS NULL OR date_start=0 OR date_start>" . time() . ") AND date_expire<=" . time() . " AND name=::{$discount_code}::"));
if (!$rs || !$rs->RecordCount() || $rs->fields["status"] != '1') {
// local check failed, attempt any discount plugins
$plg = false;
if ($this->plugins && is_array($this->plugins)) {
foreach ($this->plugins as $plugin) {
if ($discount_code = $this->plugin_validate($plugin, $discount_code)) {
$plg = true;
break;
}
}
}
// no plugins returned true...
if (!$plg) {
$C_debug->alert($C_translate->translate('invalid_discount', 'checkout', ''));
return false;
}
}
# get existing discounts:
$arr = array();
$rs = $db->Execute(sqlSelect($db, "session", "discounts", "id=::" . SESS . "::"));
if ($rs && $rs->RecordCount() && !empty($rs->fields['discounts']) && is_string($rs->fields['discounts'])) {
$arr = unserialize($rs->fields['discounts']);
}
# check for duplicates
$do = true;
if (is_array($arr)) {
foreach ($arr as $key => $discount) {
if ($discount == $discount_code) {
unset($arr[$key]);
$do = false;
}
}
}
# update session data
if ($do) {
$arr[] = $discount_code;
}
$rs = $db->Execute(sqlUpdate($db, "session", array('discounts' => serialize($arr)), "id=::" . SESS . "::"));
return true;
}
示例10: config
/** Save the configuration.
*/
function config($VAR)
{
global $C_debug;
$db =& DB();
# define the validation class
include_once PATH_CORE . 'validate.inc.php';
$validate = new CORE_validate();
$arr['min_len'] = 4;
$arr['max_len'] = 4;
if (is_numeric($VAR['voip_vm_passwd']) && !empty($VAR['voip_intrastate'])) {
$fields['voip_vm_passwd'] = $VAR['voip_vm_passwd'];
$fields['voip_intrastate'] = $VAR['voip_intrastate'];
$fields['voip_secret_gen'] = $VAR['voip_secret_gen'];
$fields['voip_default_prefix'] = $VAR['voip_default_prefix'];
$fields['prepaid_low_balance'] = $VAR['prepaid_low_balance'];
$fields['auth_domain'] = $VAR['auth_domain'];
$fields['perform_normalization'] = $VAR['perform_normalization'];
$fields['normalization_min_len'] = $VAR['normalization_min_len'];
$rs = $db->Execute(sqlSelect($db, "voip", "id", "site_id=::" . DEFAULT_SITE . "::"));
if ($rs && !$rs->EOF) {
$db->Execute(sqlUpdate($db, "voip", $fields, "site_id=::" . DEFAULT_SITE . "::"));
} else {
$db->Execute(sqlInsert($db, "voip", $fields));
}
$C_debug->alert("Saved!");
} else {
$C_debug->alert("Problems while saving:" . $db->ErrorMsg());
}
}
示例11: changeqty
/**
* Change the quantity of an item
*/
function changeqty($VAR)
{
if (empty($this->account_id)) {
$this->account_id = SESS_ACCOUNT;
}
if (empty($this->session_id)) {
$this->session_id = SESS;
}
@($id = $VAR['id']);
@($qty = $VAR['qty']);
if ($id <= 0) {
return;
}
$db =& DB();
if ($qty == '0') {
# Product Plugin Level deletion
$cartid =& $db->Execute($sql = sqlSelect($db, "cart", "*", "id=::{$id}:: AND session_id = ::{$this->session_id}::"));
if ($cartid) {
$product =& $db->Execute($sql = sqlSelect($db, "product", "*", "id=::{$cartid->fields['product_id']}::"));
}
if (!empty($product->fields['prod_plugin']) && !empty($product->fields['prod_plugin_data'])) {
$prodplgfile = PATH_PLUGINS . 'product/' . $product->fields['prod_plugin_file'] . '.php';
if (is_file($prodplgfile)) {
include_once PATH_PLUGINS . 'product/' . $product->fields['prod_plugin_file'] . '.php';
eval('$prodplg = new plgn_prov_' . $product->fields['prod_plugin_file'] . ';');
if (is_object($prodplg)) {
if (is_callable(array($prodplg, 'delete_cart'))) {
$prodplg->delete_cart($VAR, $cartid->fields);
}
}
}
}
# delete main cart items & subitems:
$sql = '';
if (empty($this->admin)) {
$sql = "AND session_id = ::{$this->session_id}::";
}
$rs =& $db->Execute($sql = sqlDelete($db, "cart", "(id=::{$id}:: OR cart_parent_id=::{$id}:: ) {$sql}"));
global $smarty;
$smarty->assign('js', false);
return false;
}
# update the quantity:
if (!eregi("^[0-9]{1,5}\$", $qty)) {
$qty = 1;
}
if ($qty < 1) {
$qty = 1;
}
if (!$this->admin) {
$sql_extra = " AND session_id=::{$this->session_id}::";
} else {
$sql_extra = '';
}
if ($VAR["type"] == 1) {
$fields = array('quantity' => $qty);
$db->Execute($sql = sqlUpdate($db, "cart", $fields, "id=::{$id}:: {$sql_extra}"));
} else {
if ($VAR["type"] == 2) {
$fields = array('recurr_schedule' => $VAR["schedule"]);
$db->Execute($sql = sqlUpdate($db, "cart", $fields, "id=::{$id}:: {$sql_extra}"));
} else {
if ($VAR["type"] == 3) {
# change domain term
$fields = array('domain_term' => $VAR["term"]);
$db->Execute($sql = sqlUpdate($db, "cart", $fields, "id=::{$id}:: {$sql_extra}"));
}
}
}
# get the product id:
$result = $db->Execute(sqlSelect($db, "cart", "*", "id={$id} {$sql_extra}", "cart_type,date_orig"));
# get the product details:
$product = $db->Execute(sqlSelect($db, "product", "*", "id={$result->fields["product_id"]}"));
if ($result->fields["cart_type"] == "2") {
# domain name, get pricing
include_once PATH_MODULES . 'host_tld/host_tld.inc.php';
$tldObj = new host_tld();
$tldprice = $tldObj->price_tld_arr($result->fields["domain_tld"], $result->fields["host_type"], false, false, false, $this->account_id);
$qty = $result->fields["domain_term"];
$base_price = $tldprice[$qty];
$setup_price = 0;
} else {
if ($result->fields["cart_type"] == "3") {
# ad-hoc, get price
$base_price = $result->fields["ad_hoc_amount"] * $result->fields["quantity"];
$setup_price = $result->fields["ad_hoc_setup"] * $result->fields["quantity"];
} else {
include_once PATH_MODULES . 'product/product.inc.php';
$productObj = new product();
# get pricing for this product:
$prod_price = $productObj->price_prod($product->fields, $result->fields["recurr_schedule"], $this->account);
$setup_price = $prod_price["setup"] * $result->fields["quantity"];
$base_price = $prod_price["base"] * $result->fields["quantity"];
# get pricing for any attributes:
$attr_price = $productObj->price_attr($product->fields, $result->fields["product_attr"], $result->fields["recurr_schedule"], $this->account);
$setup_price += $attr_price["setup"] * $result->fields["quantity"];
$base_price += $attr_price["base"] * $result->fields["quantity"];
//.........这里部分代码省略.........
示例12: generatedomaininvoice
/** Invoice expiring domains p2
*/
function generatedomaininvoice($VAR)
{
include_once PATH_MODULES . 'tax/tax.inc.php';
$taxObj = new tax();
$db =& DB();
if (is_array($VAR)) {
$expire = time();
$rs = $db->Execute(sqlSelect($db, 'service', '*', " id = ::{$VAR['id']}:: AND active=1\n\t \t\t\t\tAND type = 'domain' AND queue = 'none' AND\n\t \t\t\t\t( domain_type = 'register' OR domain_type = 'transfer' OR domain_type = 'renew' ) AND\n\t \t\t\t\t( suspend_billing = 0 OR suspend_billing IS NULL ) "));
$service = $rs->fields;
} else {
$service = $VAR;
}
if (empty($service['id'])) {
global $C_debug;
$C_debug->alert("Unable to generate domain renweal invoice due to domain status.");
return false;
}
# Get the parent invoice details:
if (!empty($service['invoice_id'])) {
$rs = $db->Execute(sqlSelect($db, 'invoice', '*', " id = {$service['invoice_id']} ", ""));
$invoice = $rs->fields;
} else {
$invoice = false;
}
# Get the account details:
$rs = $db->Execute(sqlSelect($db, 'account', '*', " id = {$service['account_id']} ", ""));
$account = $rs->fields;
# Get the account price
include_once PATH_MODULES . 'host_tld/host_tld.inc.php';
$tldObj = new host_tld();
$tld_arr = $tldObj->price_tld_arr($service['domain_tld'], 'renew', false, false, false, $service['account_id']);
foreach ($tld_arr as $term => $price) {
break;
}
# Calculate taxes:
$rs = $db->Execute($sql = sqlSelect($db, "host_tld", "taxable", "name = ::{$service['domain_tld']}::"));
if ($service['taxable'] || @$rs->fields['taxable']) {
$tax_arr = $taxObj->calculate($price, $account["country_id"], $account["state"]);
} else {
$tax_arr = false;
}
$total = $price;
$tax_amt = 0;
if (is_array($tax_arr)) {
foreach ($tax_arr as $tx) {
$tax_amt += $tx['rate'];
}
$total += $tax_amt;
}
# calculate the dates
$expire = $service['domain_date_expire'] + $term * 86400;
$due_date = $service['domain_date_expire'] - 86400 * 3;
# Create the invoice
$id = sqlGenID($db, "invoice");
$insert = $db->Execute($sql = sqlInsert($db, "invoice", array('date_orig' => time(), 'date_last' => time(), 'type' => 2, 'process_status' => 0, 'billing_status' => 0, 'suspend_billing' => 0, 'print_status' => 0, 'parent_id' => $service['invoice_id'], 'account_id' => $service['account_id'], 'account_billing_id' => $service['account_billing_id'], 'affiliate_id' => @$invoice['affiliate_id'], 'campaign_id' => @$invoice['campaign_id'], 'reseller_id' => @$invoice['reseller_id'], 'checkout_plugin_id' => @$invoice['checkout_plugin_id'], 'tax_amt' => $tax_amt, 'discount_arr' => serialize(@$discount_arr), 'discount_amt' => @$discount_amt, 'total_amt' => $total, 'billed_amt' => 0, 'billed_currency_id' => DEFAULT_CURRENCY, 'actual_billed_amt' => 0, 'actual_billed_currency_id' => @$invoice['actual_billed_currency_id'], 'notice_count' => 0, 'notice_next_date' => time(), 'notice_max' => MAX_BILLING_NOTICE, 'grace_period' => 0, 'due_date' => $due_date), $id));
# create the invoice item:
if ($insert) {
$db->Execute($idx = sqlInsert($db, "invoice_item", array('date_orig' => time(), 'invoice_id' => $id, 'account_id' => $service['account_id'], 'service_id' => $service['id'], 'sku' => 'DOMAIN-RENEW', 'quantity' => 1, 'item_type' => 2, 'price_type' => 0, 'price_base' => $price, 'price_setup' => 0, 'domain_type' => 'renew', 'date_start' => $service['domain_date_expire'], 'date_stop' => $expire, 'domain_name' => $service['domain_name'], 'domain_tld' => $service['domain_tld'], 'domain_term' => $term, 'tax_amt' => $tax_amt, 'total_amt' => $price)));
# Insert tax records
$taxObj->invoice_item($id, $idx, $service['account_id'], @$item_tax_arr);
# Update the service record
$fields = array('active' => 0);
$db->Execute(sqlUpdate($db, "service", $fields, "id = {$service['id']}"));
global $C_debug;
$C_debug->alert("Generated domain renewal invoice for {$service['domain_name']}.{$service['domain_tld']}");
return $id;
}
}
示例13: p_active
/**
* Activate a radius account
*/
function p_active()
{
$db =& DB();
$db->Execute(sqlUpdate($db, "radius", array("active" => 1), "service_id={$this->service['id']}"));
return true;
}
示例14: checkoutnow
//.........这里部分代码省略.........
}
}
}
}
if (!$recurring) {
echo '<script language=Javascript> alert("This payment option cannot be used when ordering both prorated and non-prorated subscriptions, or when ordering two or more subscriptions with different billing schedules selected. Please make sure all your subscriptions have the same billing schedule selected, try another payment option, or order one subscription at a time. We apologize for any inconvenience."); </script> ';
return false;
}
}
}
# Affiliate
if (empty($this->affiliate_id)) {
if (!empty($account->fields['affiliate_id'])) {
$invoice->affiliate_id = $account->fields['affiliate_id'];
} else {
$invoice->affiliate_id = SESS_AFFILIATE;
}
}
# Campaign
if (empty($this->campaign_id)) {
if (!empty($account->fields['campaign_id'])) {
$invoice->campaign_id = $account->fields['campaign_id'];
} else {
$invoice->campaign_id = SESS_CAMPAIGN;
}
}
$invoice->record_id = sqlGenID($db, "invoice");
$invoice->actual_billed_currency_id = SESS_CURRENCY;
$invoice->billed_currency_id = DEFAULT_CURRENCY;
$invoice->checkout_type = $PLG->type;
// initial invoice status
if ($invoice->total_amt == 0 || $PLG->type == 'gateway') {
$invoice->billing_status = 1;
$invoice->actual_billed_amt = $C_list->format_currency_decimal($invoice->total_amt, SESS_CURRENCY);
$invoice->billed_amt = $invoice->total_amt;
}
// Currency conversion:
if (SESS_CURRENCY != DEFAULT_CURRENCY) {
$bill_amt = $C_list->format_currency_decimal($invoice->total_amt, SESS_CURRENCY);
$recur_amt = $C_list->format_currency_decimal($invoice->recur_amt, SESS_CURRENCY);
} else {
$bill_amt = round($invoice->total_amt, 2);
$recur_amt = round($invoice->recur_amt, 2);
}
// Get currency ISO (three_digit) for checkout plugin
$currrs = $db->Execute(sqlSelect($db, "currency", "three_digit", "id=" . SESS_CURRENCY));
if ($currrs && $currrs->RecordCount()) {
$currency_iso = $currrs->fields['three_digit'];
}
// Run the plugin bill_checkout() method:
$currency_iso = $C_list->currency_iso(SESS_CURRENCY);
$invoice->checkout_plugin_data = $PLG->bill_checkout($bill_amt, $invoice->record_id, $currency_iso, $account->fields, $recur_amt, $invoice->recur_arr);
if ($invoice->checkout_plugin_data === false || $invoice->checkout_plugin_data == '') {
if (!empty($PLG->redirect)) {
echo $PLG->redirect;
}
return false;
} elseif ($PLG->type == "gateway" || empty($PLG->redirect)) {
$VAR['id'] = $invoice->record_id;
if (!$this->admin_checkout) {
$VAR['_page'] = "invoice:thankyou";
}
$invoice->checkout_plugin_data = false;
} elseif (!$this->admin_checkout) {
echo "<html><head></head><body><center>\n\t\t\t\tPlease wait while we redirect you to the secure payment site....\n\t\t\t\t{$PLG->redirect}</center></body></html>";
}
// Call the Plugin method for storing the checkout data:
$invoice->account_billing_id = $PLG->store_billing($VAR, $invoice->account_id);
// clear user discounts
$fields = array('discounts' => "");
$db->Execute(sqlUpdate($db, "session", $fields, "id = ::" . SESS . "::"));
// admin options
$email = true;
if ($this->admin_checkout) {
if (empty($VAR['send_email']) || $VAR['send_email'] == 'false') {
$email = false;
} else {
$email = true;
}
if (!empty($VAR['due_date'])) {
$invoice->due_date = $this->getInputDate($VAR['due_date']);
}
if (!empty($VAR['grace_period'])) {
$invoice->grace_period = $VAR['grace_period'];
}
if (!empty($VAR['notice_max'])) {
$invoice->notice_max = $VAR['notice_max'];
}
}
if ($invoice->commitNew($taxObj, $discountObj, $email)) {
// delete all cart items
$db->Execute(sqlDelete($db, "cart", "(session_id=::" . SESS . ":: OR account_id={$invoice->account_id})"));
// admin redirect
if ($this->admin_checkout) {
$url = URL . 'admin.php?_page=invoice:view&id=' . $invoice->record_id;
echo '<script language="javascript"> parent.location.href=\'' . $url . '\';</script>';
}
}
return false;
}
示例15: p_active
function p_active()
{
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "voip_did", "id,did", "service_id = {$this->service_id}"));
$did_id = $rs->fields['id'];
$fields = array('in_use' => 0);
$db->Execute(sqlUpdate($db, "voip_prepaid", $fields, "voip_did_id = {$did_id}"));
return true;
}