本文整理汇总了PHP中insert_query函数的典型用法代码示例。如果您正苦于以下问题:PHP insert_query函数的具体用法?PHP insert_query怎么用?PHP insert_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_gateway_fee2
function update_gateway_fee2($vars)
{
$paymentmethod = $vars['paymentmethod'];
delete_query("tblinvoiceitems", "invoiceid='" . $vars[invoiceid] . "' and notes='gateway_fees'");
$result = select_query("tbladdonmodules", "setting,value", "setting='fee_2_" . $vars['paymentmethod'] . "' or setting='fee_1_" . $vars[paymentmethod] . "'");
while ($data = mysql_fetch_array($result)) {
$params[$data[0]] = $data[1];
}
$fee1 = $params['fee_1_' . $paymentmethod];
$fee2 = $params['fee_2_' . $paymentmethod];
$total = InvoiceTotal($vars['invoiceid']);
if ($total > 0) {
$amountdue = $fee1 + $total * $fee2 / 100;
if ($fee1 > 0 & $fee2 > 0) {
$d = $fee1 . '+' . $fee2 . "%";
} elseif ($fee2 > 0) {
$d = $fee2 . "%";
} elseif ($fee1 > 0) {
$d = $fee1;
}
}
if ($d) {
insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "invoiceid" => $vars[invoiceid], "type" => "Fee", "notes" => "gateway_fees", "description" => getGatewayName2($vars['paymentmethod']) . " Fees ({$d})", "amount" => $amountdue, "taxed" => "0", "duedate" => "now()", "paymentmethod" => $vars[paymentmethod]));
}
updateInvoiceTotal($vars[invoiceid]);
}
示例2: getelement
function getelement($default, $language)
{
$key = md5($default);
$result = select_query('tblconfiguration', '*', array('setting' => 'Language'));
$res = mysql_fetch_assoc($result);
$defaultlang = $res['value'];
mysql_free_result($result);
$result = select_query('mod_i18n_lang', '*', '1');
while ($row = mysql_fetch_assoc($result)) {
$langs[$row['lang']] = $row['enabled'];
}
mysql_free_result($result);
if ($langs[$language] == 0) {
return $default;
} else {
$result = select_query('mod_i18n_data', '*', array('id' => $key));
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
$translations = unserialize($row['data']);
return $translations[$language];
} else {
$translations[$defaultlang] = $default;
foreach ($langs as $lang => $enabled) {
if ($enabled == 1) {
$translations[$lang] = $default;
}
}
$newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0));
return $default;
}
}
}
示例3: update_gateway_fee2
function update_gateway_fee2($vars)
{
$invoice = mysql_fetch_row(mysql_query("SELECT `userid` FROM `tblinvoices` WHERE `id`='" . $vars[invoiceid] . "'"));
$user = mysql_fetch_row(mysql_query("SELECT `currency` FROM `tblclients` WHERE `id`='" . $invoice[0] . "'"));
$currency = mysql_fetch_row(mysql_query("SELECT `code` FROM `tblcurrencies` WHERE `id`='" . $user[0] . "'"));
$paymentmethod = $vars['paymentmethod'];
delete_query("tblinvoiceitems", "invoiceid='" . $vars[invoiceid] . "' and notes='gateway_fees'");
$result = select_query("tbladdonmodules", "setting,value", "setting='fee_2_" . $vars['paymentmethod'] . '_' . $currency[0] . "' or setting='fee_1_" . $vars[paymentmethod] . '_' . $currency[0] . "'");
while ($data = mysql_fetch_array($result)) {
$params[$data['setting']] = $data['value'];
}
$fee1 = $params['fee_1_' . $paymentmethod . '_' . $currency[0]];
$fee2 = $params['fee_2_' . $paymentmethod . '_' . $currency[0]];
$total = InvoiceTotal($vars['invoiceid']);
if ($total > 0) {
$amountdue = $fee1 + $total * $fee2 / 100;
if ($fee1 > 0 & $fee2 > 0) {
$d = $fee1 . '+' . $fee2 . "%";
} elseif ($fee2 > 0) {
$d = $fee2 . "%";
} elseif ($fee1 > 0) {
$d = $fee1;
}
}
if ($d) {
insert_query("tblinvoiceitems", array("userid" => $_SESSION['uid'], "invoiceid" => $vars[invoiceid], "type" => "Fee", "notes" => "gateway_fees", "description" => getGatewayName2($vars['paymentmethod']) . " комиссия ({$d}) в " . $currency[0], "amount" => $amountdue, "taxed" => "0", "duedate" => "now()", "paymentmethod" => $vars[paymentmethod]));
}
updateInvoiceTotal($vars[invoiceid]);
}
示例4: smarty_function_i18n
function smarty_function_i18n($params, &$smarty)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/init.php";
$language = $params['lang'];
$default = $params['default'];
$key = md5($default);
$result = select_query('tblconfiguration', '*', array('setting' => 'Language'));
$res = mysql_fetch_assoc($result);
$defaultlang = $res['value'];
mysql_free_result($result);
$result = select_query('mod_i18n_lang', '*', '1');
while ($row = mysql_fetch_assoc($result)) {
$langs[$row['lang']] = $row['enabled'];
}
mysql_free_result($result);
if ($langs[$language] == 0) {
return $default;
} else {
$result = select_query('mod_i18n_data', '*', array('id' => $key));
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
$translations = unserialize($row['data']);
return $translations[$language];
} else {
$translations[$defaultlang] = $default;
foreach ($langs as $lang => $enabled) {
if ($enabled == 1) {
$translations[$lang] = $default;
}
}
$newid = insert_query('mod_i18n_data', array('id' => $key, 'default' => $default, 'data' => serialize($translations), 'translated' => 0));
return $default;
}
}
}
示例5: widget_staffboard_overview
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
* */
function widget_staffboard_overview($vars)
{
global $_ADMINLANG;
$title = "Staff Noticeboard";
$lastviews = get_query_val("tbladdonmodules", "value", array("module" => "staffboard", "setting" => "lastviewed"));
if ($lastviews) {
$lastviews = unserialize($lastviews);
$new = false;
} else {
$lastviews = array();
$new = true;
}
$lastviewed = $lastviews[$_SESSION['adminid']];
$lastviews[$_SESSION['adminid']] = time();
if ($new) {
insert_query("tbladdonmodules", array("module" => "staffboard", "setting" => "lastviewed", "value" => serialize($lastviews)));
} else {
update_query("tbladdonmodules", array("value" => serialize($lastviews)), array("module" => "staffboard", "setting" => "lastviewed"));
}
$numchanged = get_query_val("mod_staffboard", "COUNT(id)", "date>='" . date("Y-m-d H:i:s", $lastviewed) . "'");
$content = "\n<style>\n.staffboardchanges {\n margin: 0 0 5px 0;\n padding: 8px 25px;\n font-size: 1.2em;\n text-align: center;\n}\n.staffboardnotices {\n max-height: 130px;\n overflow: auto;\n border-top: 1px solid #ccc;\n border-bottom: 1px solid #ccc;\n}\n.staffboardnotices div {\n padding: 5px 15px;\n border-bottom: 2px solid #fff;\n}\n.staffboardnotices div.pink {\n background-color: #F3CBF3;\n}\n.staffboardnotices div.yellow {\n background-color: #FFFFC1;\n}\n.staffboardnotices div.purple {\n background-color: #DCD7FE;\n}\n.staffboardnotices div.white {\n background-color: #FAFAFA;\n}\n.staffboardnotices div.pink {\n background-color: #F3CBF3;\n}\n.staffboardnotices div.blue {\n background-color: #A6E3FC;\n}\n.staffboardnotices div.green {\n background-color: #A5F88B;\n}\n</style>\n<div class=\"staffboardchanges\">There are <strong>" . $numchanged . "</strong> New or Updated Staff Notices Since your Last Visit - <a href=\"addonmodules.php?module=staffboard\">Visit Noticeboard »</a></div><div class=\"staffboardnotices\">";
$result = select_query("mod_staffboard", "", "", "date", "DESC");
while ($data = mysql_fetch_array($result)) {
$content .= "<div class=\"" . $data['color'] . "\">" . fromMySQLDate($data['date'], 1) . " - " . (100 < strlen($data['note']) ? substr($data['note'], 0, 100) . "..." : $data['note']) . "</div>";
}
$content .= "</div>";
return array("title" => $title, "content" => $content, "jquerycode" => $jquerycode);
}
示例6: createOrder
public function createOrder($userid, $paymentmethod, $contactid = "")
{
global $whmcs;
$order_number = generateUniqueID();
$this->orderid = insert_query("tblorders", array("ordernum" => $order_number, "userid" => $userid, "contactid" => $contactid, "date" => "now()", "status" => "Pending", "paymentmethod" => $paymentmethod, "ipaddress" => $whmcs->get_user_ip()));
logActivity("New Order Created - Order ID: " . $orderid . " - User ID: " . $userid);
return $this->orderid;
}
示例7: create_payment_id
/**
* Create & Assign a new payment ID to user
*
* @param object User
* @return string payment id
*/
public function create_payment_id($user)
{
$res = false;
// Keep generating payment id until successfully inserted.
while (!$res) {
$payment_id = random_str(64);
$sql = insert_query('users_cn_payment_ids', array('asset_id' => $this->id, 'payment_id' => $payment_id, 'user_id' => $user->id(), 'date_created' => array('UTC_TIMESTAMP()')));
$res = db()->query($sql);
}
return $payment_id;
}
示例8: noti_output
function noti_output($vars)
{
global $customadminpath, $CONFIG;
$access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
if ($_GET['return'] == '1' && $_SESSION['request_token']) {
$response = curlCall("http://notiapp.com/api/v1/get_access_token", array('app' => $vars['key'], 'request_token' => $_SESSION['request_token']));
$result = json_decode($response, true);
insert_query("tblnoti", array("adminid" => $_SESSION['adminid'], "access_token" => $result['access_token']));
$_SESSION['request_token'] = "";
curlCall("http://notiapp.com/api/v1/add", array('app' => $vars['key'], 'user' => $result['access_token'], "notification[title]" => "WHMCS is ready to go!", "notification[text]" => "You will now receive WHMCS notifications directly to your desktop", "notification[sound]" => "alert1"));
header("Location: addonmodules.php?module=noti");
} elseif ($_GET['setup'] == '1' && !mysql_num_rows($access_token)) {
$response = curlCall("http://notiapp.com/api/v1/request_access", array('app' => $vars['key'], 'redirect_url' => $CONFIG['SystemURL'] . "/" . $customadminpath . "/addonmodules.php?module=noti&return=1"));
$result = json_decode($response, true);
if ($result['request_token'] && $result['redirect_url']) {
$_SESSION['request_token'] = $result['request_token'];
header("Location: " . $result['redirect_url']);
} else {
echo "<div class='errorbox'><strong>Incorrect API Key</strong></br>Incorrect Noti API Key specified.</div>";
}
} elseif ($_GET['disable'] == '1' && mysql_num_rows($access_token)) {
full_query("DELETE FROM `tblnoti` WHERE `adminid` = '" . $_SESSION['adminid'] . "'");
echo "<div class='infobox'><strong>Successfully Disabled Noti</strong></br>You have successfully disabled Noti.</div>";
} elseif (mysql_num_rows($access_token) && $_POST) {
update_query('tblnoti', array('permissions' => serialize($_POST['notification'])), array('adminid' => $_SESSION['adminid']));
echo "<div class='infobox'><strong>Updated Notifications</strong></br>You have successfully updated your notification preferences.</div>";
}
$access_token = select_query('tblnoti', '', array('adminid' => $_SESSION['adminid']));
$result = mysql_fetch_array($access_token, MYSQL_ASSOC);
$permissions = unserialize($result['permissions']);
if (!mysql_num_rows($access_token)) {
echo "<p><a href='addonmodules.php?module=noti&setup=1'>Setup Noti</a></p>";
} else {
echo "<p><a href='addonmodules.php?module=noti&disable=1'>Disable Noti</a></p>";
echo '<form method="POST"><table class="form" width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td class="fieldlabel" width="200px">Notifications</td>
<td class="fieldarea">
<table width="100%">
<tr>
<td valign="top">
<input type="checkbox" name="notification[new_client]" value="1" id="notifications_new_client" ' . ($permissions['new_client'] == "1" ? "checked" : "") . '> <label for="notifications_new_client">New Clients</label><br>
<input type="checkbox" name="notification[new_invoice]" value="1" id="notifications_new_invoice" ' . ($permissions['new_invoice'] == "1" ? "checked" : "") . '> <label for="notifications_new_invoice">Paid Invoices</label><br>
<input type="checkbox" name="notification[new_ticket]" value="1" id="notifications_new_ticket" ' . ($permissions['new_ticket'] == "1" ? "checked" : "") . '> <label for="notifications_new_ticket">New Support Ticket</label><br>
</td>
</tr>
</table>
</table>
<p align="center"><input type="submit" value="Save Changes" class="button"></p></form>
';
}
}
示例9: create
public static function create($identity, $data = null)
{
$founder = $data['founder'] ? $data['founder'] : null;
$desc = $data['description'] ? $data['description'] : '';
$url = isset($data['clan_avatar_url']) ? $data['clan_avatar_url'] : null;
$name = $identity;
$new_clan_id = insert_query('insert into clan (clan_name, clan_avatar_url, clan_founder, description) values (:name, :url, :founder, :desc)', [':name' => $name, ':url' => $url, ':founder' => $founder, ':desc' => $desc], 'clan_clan_id_seq');
if (!positive_int($new_clan_id)) {
throw new \Exception('Clan not inserted into database properly!');
}
return ClanFactory::find($new_clan_id);
}
示例10: enomtruste_CreateAccount
function enomtruste_CreateAccount($params)
{
updateService(array("username" => "", "password" => ""));
$withseal = $params['configoption3'];
$numyears = $params['configoption4'];
$result = select_query("tblhosting", "billingcycle", array("id" => $params['serviceid']));
$data = mysql_fetch_array($result);
$billingcycle = $data[0];
if ($billingcycle == "Biennially") {
$numyears = "2";
}
if ($billingcycle == "Triennially") {
$numyears = "3";
}
if ($params['configoptions']['Seal']) {
$withseal = true;
}
if ($params['configoptions']['NumYears']) {
$numyears = $params['configoptions']['NumYears'];
}
$apiproducttype = $withseal ? "TRUSTePrivacyPolicySeal" : "TRUSTePrivacyPolicy";
$postfields = array();
$postfields['command'] = "PurchaseServices";
$postfields['Service'] = $apiproducttype;
$postfields['NumYears'] = $numyears;
$postfields['EmailNotify'] = "0";
$xmldata = enomtruste_call($params, $postfields);
if ($xmldata['INTERFACE-RESPONSE']['ERRCOUNT'] == 0) {
$result = "success";
if (!mysql_num_rows(full_query("SHOW TABLES LIKE 'mod_enomtruste'"))) {
full_query("CREATE TABLE `mod_enomtruste` ( `serviceid` INT(10) NOT NULL , `subscrid` INT(10) NOT NULL )");
}
$subscrid = $xmldata['INTERFACE-RESPONSE']['SUBSCRIPTIONID'];
insert_query("mod_enomtruste", array("serviceid" => $params['serviceid'], "subscrid" => $subscrid));
$domain = $params['domain'];
if (!$domain) {
$domain = $params['customfields']["Domain Name"];
}
$postfields = array();
$postfields['command'] = "PP_UpdateSubscriptionDetails";
$postfields['SubscriptionID'] = $subscrid;
$postfields['DomainName'] = $domain;
$postfields['EmailAddress'] = $params['clientsdetails']['email'];
$xmldata = enomtruste_call($params, $postfields);
} else {
$result = $xmldata['INTERFACE-RESPONSE']['ERRORS']['ERR1'];
if (!$result) {
$result = "An Unknown Error Occurred";
}
}
return $result;
}
示例11: request_insert
function request_insert($index, $insert)
{
$sql = insert_query($index, $insert);
$conn = connect_db();
try {
$stmt = $conn->prepare($sql);
$stmt->execute();
return $stmt;
} catch (PDOException $e) {
echo "inserted failed" . $e->getMessage();
}
// end catch
}
示例12: updateAddonSettings
public function updateAddonSettings($addonId, $settings, $type)
{
$addon = monitisSqlHelper::objQuery('SELECT * FROM mod_monitis_addon WHERE addon_id=' . $addonId);
if ($addon && count($addon) > 0) {
$value = array('settings' => $settings, 'type' => $type);
$where = array('addon_id' => $addonId);
update_query('mod_monitis_addon', $value, $where);
return 'update';
} else {
$value = array('addon_id' => $addonId, 'type' => $type, 'settings' => $settings, 'status' => 'active');
insert_query('mod_monitis_addon', $value);
return 'create';
}
}
示例13: globalsignssl_CreateAccount
function globalsignssl_CreateAccount($params)
{
$result = select_query("tblsslorders", "COUNT(*)", array("serviceid" => $params['serviceid']));
$data = mysql_fetch_array($result);
if ($data[0]) {
return "An SSL Order already exists for this order";
}
updateService(array("username" => "", "password" => ""));
$sslorderid = insert_query("tblsslorders", array("userid" => $params['clientsdetails']['userid'], "serviceid" => $params['serviceid'], "remoteid" => "", "module" => "globalsignssl", "certtype" => $params['configoption3'], "status" => "Awaiting Configuration"));
global $CONFIG;
$sslconfigurationlink = $CONFIG['SystemURL'] . "/configuressl.php?cert=" . md5($sslorderid);
$sslconfigurationlink = "<a href=\"" . $sslconfigurationlink . "\">" . $sslconfigurationlink . "</a>";
sendMessage("SSL Certificate Configuration Required", $params['serviceid'], array("ssl_configuration_link" => $sslconfigurationlink));
return "success";
}
示例14: KuJoe
/**
Proxy/VPN Detection Hook for WHMCS by KuJoe (JMD.cc)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**/
function chkProxyMM($vars)
{
// Set me!
$license_key = 'MAXMIND_LICENSE_KEY';
# Set this to your MaxMind License Key (your account must have Proxy Detection queries).
$email = 'you@example.com';
# This is the e-mail alerts will be sent to.
// Optional
$max_score = '1.7';
# Likelihood of proxy (0.5 = 15%, 1.0 = 30%, 2.0 = 60%, 3.0+ = 90%)
$error = '# You appear to be ordering from a proxy/VPN. Please logout of your proxy/VPN to continue ordering. If you believe that you received this error by mistake, please open a ticket with your IP address and we will investigate further. Thank you.';
$subject = "chkProxy Error";
// No need to edit anything below this.
$ipaddress = $_SERVER['REMOTE_ADDR'];
$result = select_query("mod_chkproxy_mm", "", array("ipaddr" => $ipaddress));
if (mysql_num_rows($result) == 0) {
$query = "https://minfraud.maxmind.com/app/ipauth_http?l=" . $license_key . "&i=" . $ipaddress;
$query = file_get_contents($query);
$score = substr($query, strpos($query, "=") + 1);
if (is_numeric($score)) {
insert_query("mod_chkproxy_mm", array("ipaddr" => $ipaddress, "proxyscore" => $score));
if ($score >= $max_score) {
global $errormessage;
$errormessage .= $error;
}
} else {
if ($score == 'MAX_REQUESTS_REACHED') {
$maxmsg = "You do not have any MaxMind queries left (" . $score . "). The chkProxy script will no longer work and you will keep getting this e-mail until more queries are added.";
mail($email, $subject, $maxmsg);
} elseif ($score == 'LICENSE_REQUIRED') {
$nolicmsg = "You do not have a valid MaxMind license (" . $score . "). Please verify your license key is correct or else the chkProxy script will not work and you will keep getting this e-mail.";
mail($email, $subject, $nolicmsg);
} else {
$genmsg = "The return message received is new to us so please alert the chkProxy developer (http://jmd.cc) of this message received in the following link: https://minfraud.maxmind.com/app/ipauth_http?l=" . $license_key . "&i=" . $ipaddress;
mail($email, $subject, $genmsg);
}
}
} else {
$data = mysql_fetch_assoc($result);
if ($data['ignore'] == 0) {
$score = $data['proxyscore'];
if ($score >= $max_score) {
global $errormessage;
$errormessage .= $error;
}
}
}
}
示例15: affiliateActivate
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
**/
function affiliateActivate($userid)
{
global $CONFIG;
$result = select_query("tblclients", "currency", array("id" => $userid));
$data = mysql_fetch_array($result);
$clientcurrency = $data['currency'];
$bonusdeposit = convertCurrency($CONFIG['AffiliateBonusDeposit'], 1, $clientcurrency);
$result = select_query("tblaffiliates", "id", array("clientid" => $userid));
$data = mysql_fetch_array($result);
$affiliateid = $data['id'];
if (!$affiliateid) {
$affiliateid = insert_query("tblaffiliates", array("date" => "now()", "clientid" => $userid, "balance" => $bonusdeposit));
}
logActivity("Activated Affiliate Account - Affiliate ID: " . $affiliateid . " - User ID: " . $userid, $userid);
run_hook("AffiliateActivation", array("affid" => $affiliateid, "userid" => $userid));
}