本文整理汇总了PHP中select_query函数的典型用法代码示例。如果您正苦于以下问题:PHP select_query函数的具体用法?PHP select_query怎么用?PHP select_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SupressPaymentReminders
function SupressPaymentReminders($vars)
{
/*
* Prevents incorrect payment reminder emails from being
* sent whilst the payment request is inflight. If the
* payment fails we send the reminders.
*/
$email_template_name = $vars['messagename'];
# Email template name being sent
if ($email_template_name == 'Credit Card Payment Failed' || $email_template_name == 'Invoice Payment Reminder' || $email_template_name == 'First Invoice Overdue Notice' || $email_template_name == 'Second Invoice Overdue Notice' || $email_template_name == 'Third Invoice Overdue Notice') {
$invoiceid = $vars['relid'];
$result = select_query("mod_gocardless", "payment_failed", array("invoiceid" => $invoiceid));
$data = mysql_fetch_array($result);
if (empty($data)) {
$merge_fields = array();
$merge_fields['abortsend'] = false;
} else {
if ($data['payment_failed'] == 0) {
$merge_fields = array();
$merge_fields['abortsend'] = true;
# You can use this return to stop email sending
return $merge_fields;
}
}
}
}
示例2: ZopimLiveChatJS
function ZopimLiveChatJS($vars)
{
$scripts = "";
$q = @mysql_query("SELECT * FROM tbladdonmodules WHERE module = 'zopimlivechat'");
while ($arr = mysql_fetch_array($q)) {
$settings[$arr['setting']] = $arr['value'];
}
if (isset($settings['z_user'])) {
$q2 = @mysql_query("SELECT * FROM mod_zopimlivechat WHERE user = '" . $settings['z_user'] . "' ");
$arr2 = mysql_fetch_array($q2);
$code = $arr2['key'];
$table = "mod_zopimlivechat";
$fields = "user,salt,key";
$where = array("user" => $settings['z_user']);
$result = select_query($table, $fields, $where);
$data = mysql_fetch_array($result);
$scripts = "<!--Start of Zopim Live Chat Script-->\n<script type=\"text/javascript\">\nwindow.\$zopim||(function(d,s){var z=\$zopim=function(c){z._.push(c)},\$=z.s=\nd.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.\n_.push(o)};z._=[];z.set._=[];\$.async=!0;\$.setAttribute('charset','utf-8');\n\$.src='//cdn.zopim.com/?" . $code . "';z.t=+new Date;\$.\ntype='text/javascript';e.parentNode.insertBefore(\$,e)})(document,'script');\n</script>\n<!--End of Zopim Live Chat Script-->";
if ($_SESSION['uid']) {
$userid = $_SESSION['uid'];
$result = mysql_query("SELECT firstname,lastname,email FROM tblclients WHERE id={$userid}");
$data = mysql_fetch_array($result);
$firstname = $data["firstname"];
$lastname = $data["lastname"];
$email = $data["email"];
$scripts .= "<script type=\"text/javascript\">\n \$zopim(function() {\n \$zopim.livechat.setName('" . $firstname . " " . $lastname . "');\n \$zopim.livechat.setEmail('" . $email . "');\n });\n</script>\n";
}
}
return $scripts;
}
示例3: doUnsubscribe
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
**/
function doUnsubscribe($email, $key)
{
global $whmcs;
global $_LANG;
$whmcs->get_hash();
if (!$email) {
return $_LANG['pwresetemailrequired'];
}
$result = select_query("tblclients", "id,email,emailoptout", array("email" => $email));
$data = mysql_fetch_array($result);
$userid = $data['id'];
$email = $data['email'];
$emailoptout = $data['emailoptout'];
$newkey = sha1($email . $userid . $cc_encryption_hash);
if ($newkey == $key) {
if (!$userid) {
return $_LANG['unsubscribehashinvalid'];
}
if ($emailoptout == 1) {
return $_LANG['alreadyunsubscribed'];
}
update_query("tblclients", array("emailoptout" => "1"), array("id" => $userid));
sendMessage("Unsubscribe Confirmation", $userid);
logActivity("Unsubscribed From Marketing Emails - User ID:" . $userid, $userid);
return null;
}
return $_LANG['unsubscribehashinvalid'];
}
示例4: getAvailableGateways
public function getAvailableGateways($invoiceid = "")
{
$validgateways = array();
$result = full_query("SELECT DISTINCT gateway, (SELECT value FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `name`, (SELECT `order` FROM tblpaymentgateways g2 WHERE g1.gateway=g2.gateway AND setting='name' LIMIT 1) AS `order` FROM `tblpaymentgateways` g1 WHERE setting='visible' AND value='on' ORDER BY `order` ASC");
while ($data = mysql_fetch_array($result)) {
$validgateways[$data[0]] = $data[1];
}
if ($invoiceid) {
$disabledgateways = array();
$result = select_query("tblinvoiceitems", "", array("type" => "Hosting", "invoiceid" => $invoiceid));
while ($data = mysql_fetch_assoc($result)) {
$relid = $data['relid'];
if ($relid) {
$result2 = full_query("SELECT pg.disabledgateways AS disabled FROM tblhosting h LEFT JOIN tblproducts p on h.packageid = p.id LEFT JOIN tblproductgroups pg on p.gid = pg.id where h.id = " . (int) $relid);
$data2 = mysql_fetch_assoc($result2);
$gateways = explode(",", $data2['disabled']);
foreach ($gateways as $gateway) {
if (array_key_exists($gateway, $validgateways)) {
unset($validgateways[$gateway]);
continue;
}
}
}
}
}
return $validgateways;
}
示例5: cloudmin_ConfigOptions
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
* */
function cloudmin_ConfigOptions()
{
global $packageconfigoption;
$imagesresult = "";
if ($packageconfigoption[6]) {
$result = select_query("tblservers", "", array("type" => "cloudmin", "active" => "1"));
$data = mysql_fetch_array($result);
$params['serverip'] = $data['ipaddress'];
$params['serverhostname'] = $data['hostname'];
$params['serverusername'] = $data['username'];
$params['serverpassword'] = decrypt($data['password']);
$params['serveraccesshash'] = $data['accesshash'];
$params['serversecure'] = $data['secure'];
if ($params['serverusername']) {
$postfields = array();
$postfields['program'] = "list-images";
$imagesresult = cloudmin_req($params, $postfields);
}
}
$configarray = array("Type" => array("Type" => "dropdown", "Options" => "xen,openvz,vservers,zones,real"), "Xen Host" => array("Type" => "text", "Size" => "30", "Description" => "(Optional)"), "Setup Type" => array("Type" => "dropdown", "Options" => "system,owner"), "Plan Name" => array("Type" => "text", "Size" => "20", "Description" => ""));
if (is_array($imagesresult)) {
$configarray['Image'] = array("Type" => "dropdown", "Options" => implode(",", $imagesresult));
} else {
$configarray['Image'] = array("Type" => "text", "Size" => "30");
}
$configarray["Get From Server"] = array("Type" => "yesno", "Description" => "Tick this box to load Image options from default server");
return $configarray;
}
示例6: widget_todo_list
function widget_todo_list($vars)
{
global $_ADMINLANG;
$content = '<table width="100%" bgcolor="#cccccc" cellspacing="1">
<tr bgcolor=#efefef style="text-align:center;font-weight:bold;"><td>' . $_ADMINLANG['fields']['date'] . '</td><td>' . $_ADMINLANG['fields']['title'] . '/' . $_ADMINLANG['fields']['description'] . '</td><td>' . $_ADMINLANG['fields']['duedate'] . '</td><td>' . $_ADMINLANG['fields']['status'] . '</td><td width="20"></td></tr>
';
$id = '';
$result = select_query("tbltodolist", "", array("status" => array("sqltype" => "NEQ", "value" => "Completed")), "duedate", "ASC");
while ($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$description = $data["description"];
$admin = $data["admin"];
$status = $data["status"];
$duedate = $data["duedate"];
$date = fromMySQLDate($date);
$duedate = $duedate == "0000-00-00" ? '-' : fromMySQLDate($duedate);
$bgcolor = $admin == $vars['adminid'] ? "#f5f5d7" : "#ffffff";
$description = strlen($description) > 50 ? substr($description, 0, 50) . '...' : $description;
$content .= '<tr bgcolor="' . $bgcolor . '" style="text-align:center;"><td>' . $date . '</td><td>' . $title . ' - ' . $description . '</td><td>' . $duedate . '</td><td>' . $status . '</td><td><a href="todolist.php?action=edit&id=' . $id . '"><img src="images/edit.gif" border="0"></a></td></tr>
';
}
if (!$id) {
$content .= '<tr bgcolor="#ffffff"><td colspan="5" align="center">' . $_ADMINLANG['global']['norecordsfound'] . '</td></tr>';
}
$content .= '</table>
<div align="right" style="padding-top:5px;"><a href="todolist.php">' . $_ADMINLANG['home']['manage'] . ' »</a></div>';
$title = $_ADMINLANG['todolist']['todolisttitle'];
return array('title' => $title, 'content' => $content);
}
示例7: whmcs2slack_module_settings
function whmcs2slack_module_settings()
{
$fields = "module,setting,value";
$where = array("module" => "whmcs2slack");
$result = select_query('tbladdonmodules', $fields, $where);
$whmcs2slack_configuration = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$whmcs2slack_configuration[$row["setting"]] = $row["value"];
}
return $whmcs2slack_configuration;
/*
Array
(
[version] => 0.1
[url] => https://hooks.slack.com/services/someslackapitoken
[botname] => WHMCSbot
[orders_channel] => @shalom
[orders_emoji] => :question:
[tickets_channel] => @shalom
[tickets_emoji] => :space_invader:
[payments_channel] => @shalom
[payments_emoji] => :moneybag:
[client_channel] => @shalom
[client_emoji] => :moneybag:
[access] => 4,1,10
[debug] => on
)
*/
}
示例8: getActiveFraudModule
function getActiveFraudModule()
{
global $CONFIG;
$result = select_query("tblfraud", "fraud", array("setting" => "Enable", "value" => "on"));
$data = mysql_fetch_array($result);
$fraud = $data['fraud'];
$orderid = $_SESSION['orderdetails']['OrderID'];
if ($CONFIG['SkipFraudForExisting']) {
$result = select_query("tblorders", "COUNT(*)", array("status" => "Active", "userid" => $_SESSION['uid']));
$data = mysql_fetch_array($result);
if ($data[0]) {
$fraudmodule = "";
logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Already Active Orders");
}
}
$hookresponses = run_hook("RunFraudCheck", array("orderid" => $orderid, "userid" => $_SESSION['uid']));
foreach ($hookresponses as $hookresponse) {
if ($hookresponse) {
$fraud = "";
logActivity("Order ID " . $orderid . " Skipped Fraud Check due to Custom Hook");
continue;
}
}
return $fraud;
}
示例9: signedinvoicedata
function signedinvoicedata()
{
$data = select_query("mod_signedinvoices", "name, value", array());
if (mysql_num_rows($data)) {
while ($r = mysql_fetch_array($data)) {
switch ($r['name']) {
case "cert":
$cert = $r['value'];
break;
case "key":
$key = $r['value'];
break;
case "keypass":
$keypass = decrypt($r['value']);
break;
case "extra":
$extra = $r['value'];
break;
}
}
if (isset($cert) && isset($key)) {
$status = "success";
return array('status' => 'success', 'cert' => $cert, 'key' => $key, 'keypass' => $keypass, 'extra' => $extra);
} else {
return array('status' => 'failure', 'message' => 'SIGNEDINVOICES: Missing private key and/or certificate!');
}
} else {
return array('status' => 'failure', 'message' => 'SIGNEDINVOICES: Something went wrong, the mod_signedinvoices table does not contain data!');
}
}
示例10: buildCategoriesList
function buildCategoriesList($level, $parentlevel, $exclude = "")
{
global $categorieslist;
global $categories;
$result = select_query("tblknowledgebasecats", "", array("parentid" => $level, "catid" => 0), "name", "ASC");
while ($data = mysql_fetch_array($result)) {
$id = $data['id'];
$parentid = $data['parentid'];
$category = $data['name'];
if ($id != $exclude) {
$categorieslist .= "<option value=\"" . $id . "\"";
if (in_array($id, $categories)) {
$categorieslist .= " selected";
}
$categorieslist .= ">";
$i = 1;
while ($i <= $parentlevel) {
$categorieslist .= "- ";
++$i;
}
$categorieslist .= "" . $category . "</option>";
}
buildCategoriesList($id, $parentlevel + 1, $exclude);
}
}
示例11: 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;
}
}
}
示例12: 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);
}
示例13: widget_activity_log
function widget_activity_log($vars)
{
global $_ADMINLANG;
$title = $_ADMINLANG['utilities']['activitylog'];
$content = '';
$patterns = $replacements = array();
$patterns[] = '/User ID: (.*?) /';
$patterns[] = '/Service ID: (.*?) /';
$patterns[] = '/Domain ID: (.*?) /';
$patterns[] = '/Invoice ID: (.*?) /';
$patterns[] = '/Order ID: (.*?) /';
$patterns[] = '/Transaction ID: (.*?) /';
$replacements[] = '<a href="clientssummary.php?userid=$1">User ID: $1</a> ';
$replacements[] = '<a href="clientshosting.php?id=$1">Service ID: $1</a> ';
$replacements[] = '<a href="clientsdomains.php?id=$1">Domain ID: $1</a> ';
$replacements[] = '<a href="invoices.php?action=edit&id=$1">Invoice ID: $1</a> ';
$replacements[] = '<a href="orders.php?action=view&id=$1">Order ID: $1</a> ';
$replacements[] = '<a href="transactions.php?action=edit&id=$1">Transaction ID: $1</a> ';
$result = select_query("tblactivitylog", "", "", "id", "DESC", "0,10");
while ($data = mysql_fetch_array($result)) {
$description = $data["description"] . ' ';
$description = whmcsHtmlspecialchars($description);
$description = preg_replace($patterns, $replacements, $description);
$content .= $description . '<br /><span style="font-size:11px;"> - ' . fromMySQLDate($data["date"], true) . ' - ' . $data['user'] . ' - ' . $data['ipaddr'] . '</span><br />';
}
if (!$content) {
$content = '<div align="center">No Activity Recorded Yet</div>';
} else {
$content .= '<div align="right"><a href="systemactivitylog.php">' . $_ADMINLANG['home']['viewall'] . ' »</a></div>';
}
return array('title' => $title, 'content' => $content);
}
示例14: 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;
}
}
}
示例15: stop_users_vms
function stop_users_vms()
{
logActivity("Starting to stop vms for users.");
//Find all users whos credit is low
$table = "tblclients";
$fields = "*";
$result = select_query($table, $fields);
if ($result) {
while ($data = mysql_fetch_array($result)) {
$userid = $data['id'];
$balanceLimit = get_balance_limit($userid);
if (!$balanceLimit || !is_numeric($balanceLimit)) {
$balanceLimit = 0;
}
logActivity("Balance limit for user " . $userid . ": " . $balanceLimit);
if (getCreditForUserId($userid) + $balanceLimit < 0) {
logActivity("Stopping vms for user: " . $userid);
$command = '/bin/stopvms?arg=-u&arg=' . $userid . '&asynchronous';
$res = oms_command($command);
if ($res != -1) {
logActivity("Stopped vms for user: " . $userid . ". Result:" . $res);
} else {
logActivity("Stoping vms failed for user: " . $userid);
}
}
}
}
logActivity("Stopping vms for users ended.");
}