本文整理汇总了PHP中DBConnection::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::fetch方法的具体用法?PHP DBConnection::fetch怎么用?PHP DBConnection::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mailForm
function mailForm(){
$db=new DBConnection();
$templates=array();
$templates[0]='Select template to use';
$query='SELECT mail_templates_id, mail_template_title FROM mail_templates ORDER BY mail_template_title';
$res=$db->rq($query);
while(($row=$db->fetch($res)) != FALSE) {
$templates[$row['mail_templates_id']]=$row['mail_template_title'];
}
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>Editing Mail Settings</b></div>
<form name="addNewExpDate" method="POST" id="MainForms" action="">
<fieldset class="mainFormHolder" style="width:400px;">
<legend>SMTP Settings</legend>';
$query='SELECT * FROM global_settings WHERE section="mail_assigns"';
$res=$db->rq($query);
while(($row=$db->fetch($res)) != FALSE) {
$pcontent.='
<div class="formsLeft" style="width:150px;">'.$row['variable'].':</div>
<div class="formsRight">
<select name="Assign'.$row['global_settings_id'].'" class="text-input">';
foreach ($templates AS $TemplateID=>$TemplateName) {
$pcontent.='<option value="'.$TemplateID.'"'.(($TemplateID==$row['variable_value'])?' selected':'').'>'.$TemplateName.'</option>';
}
$pcontent.='
</select>
</div>
<br />';
}
$pcontent.='
<input type="hidden" name="_form_submit" value="1" />
<input type="submit" name="_submit" value="'.getLang('sform_savebtn').'" class="submitBtn ui-state-default" />
<input type="button" name="_cancel" value="'.getLang('sform_backbtn').'" class="submitBtn ui-state-default" onclick="location=\'mails_assigns.php\';" />
</fieldset>
</form>
</div>';
$db->close();
return $pcontent;
}
示例2: addNewAdvisor
function addNewAdvisor($users_advisors_id=0) {
if ($users_advisors_id&&!$_POST['_form_submit']){
$_SESSION['admin']['uedit']=$users_advisors_id;
$db=new DBConnection();
$query='SELECT * FROM users_advisors WHERE users_advisors_id='.($users_advisors_id+0).'';
$res=$db->rq($query);
foreach ($db->fetch($res) as $RowName=>$RowValue){
$FormFieldName=str_replace('advisor_', '', $RowName);
$_POST[$FormFieldName]=$RowValue;
}
$db->close();
}
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($users_advisors_id>0)?'Editing':'Creating New').' Advisor</b></div>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/advisors.js"></script>
<form name="addNewAdvisor" method="POST" id="MainForms" action="">
<fieldset class="mainFormHolder">
<legend>User information</legend>
<div class="formsLeft">REF:</div>
<div class="formsRight">
<input class="text-input" type="text" name="ref" id="ref" value="'.$_POST['ref'].'" />
</div>
<br />
<div class="formsLeft">Names:</div>
<div class="formsRight">
<input class="text-input" name="names" id="names" value="'.$_POST['names'].'" />
</div>
<br />
<div class="formsLeft">Firm:</div>
<div class="formsRight">
<input class="text-input" name="firm" id="firm" value="'.$_POST['firm'].'" />
</div>
<br />
<div class="formsLeft">Contacts:</div>
<div class="formsRight">
<input class="text-input" name="contacts" id="contacts" value="'.$_POST['contacts'].'" />
</div>
<input type="hidden" name="_form_submit" value="1" />
<input type="submit" name="_submit" value="'.getLang('sform_savebtn').'" class="submitBtn ui-state-default" />
';
if ($users_advisors_id){
$pcontent.='
<input type="hidden" name="advid" value="'.$users_advisors_id.'">
<input type="button" name="_delete" value="'.getLang('sform_delbtn').'" class="submitBtn ui-state-default" onclick="if(confirm(\'Are you sure you want to delete this advisor?\')) location=\'?action=delete&advid='.($_POST['users_advisors_id']+0).'\';" />';
}
$pcontent.='
<input type="button" name="_cancel" value="'.getLang('sform_backbtn').'" class="submitBtn ui-state-default" onclick="location=\'users_advisors.php\';" />
</fieldset>
</form>
</div>';
return $pcontent;
}
示例3: addNewExpDate
function addNewExpDate($expiry_dates_id=0){
if($expiry_dates_id&&!$_POST['_form_submit']) {
$_SESSION['admin']['uedit']=$expiry_dates_id;
$db=new DBConnection();
$query='SELECT * FROM expiry_dates WHERE expiry_dates_id='.($expiry_dates_id+0).'';
$res=$db->rq($query);
foreach ($db->fetch($res) AS $RowName=>$RowValue) {
$_POST[$RowName]=$RowValue;
}
$db->close();
}
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($expiry_dates_id>0)?'Editing':'Creating New').' Expiry Date</b></div>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/expiry_dates.js"></script>
<form name="addNewExpDate" method="POST" id="MainForms" action="">
<fieldset class="mainFormHolder">
<legend>Date information</legend>
<div class="formsLeft">Expiry date:</div>
<div class="formsRight">
<input class="text-input" type="text" name="expiry_date" id="expiry_date" value="'.$_POST['expiry_date'].'" autocomplete="off" />
</div>
<input type="hidden" name="_form_submit" value="1" />
<input type="submit" name="_submit" value="'.getLang('sform_savebtn').'" class="submitBtn ui-state-default" />';
if($expiry_dates_id) {
$pcontent.='
<input type="hidden" name="edid" value="'.$expiry_dates_id.'">
<input type="button" name="_delete" value="'.getLang('sform_delbtn').'" class="submitBtn ui-state-default" onclick="if(confirm(\'Are you sure you want to delete this expiry date?\')) location=\'?action=delete&edid='.($_POST['expiry_dates_id']+0).'\';" />';
}
$pcontent.='
<input type="button" name="_cancel" value="'.getLang('sform_backbtn').'" class="submitBtn ui-state-default" onclick="location=\'expiry_dates.php\';" />
</fieldset>
</form>
</div>';
return $pcontent;
}
示例4: addNewUser
function addNewUser($users_id=0) {
$db=new DBConnection();
if($users_id&&!$_POST['_form_submit']) {
$query='SELECT * FROM users WHERE user_account_num="'.$users_id.'"';
$res=$db->rq($query);
$_POST=$db->fetch($res);
$_SESSION['admin']['uedit']=$_POST['users_id'];
$FullREF=explode('-', $_POST['user_fullref']);
$UserNID=$FullREF[1];
$JSCripts='';
}else {
$JSCripts=' onkeyup="generateAccountInfos();" onblur="generateAccountInfos();"';
$_POST['user_password']='xy'.date('d', CUSTOMTIME).'r89';
$_POST['user_app_date']=date('Y-m-d', CUSTOMTIME);
}
global $userTitles;
global $userStatuses;
global $userBankCodeTypes;
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($users_id>0)?'Editing':'Creating New').' User Account</b></div>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/users.js"></script>
<form name="addNewUser" method="POST" id="MainForms" action="">
<div class="left">
<fieldset class="mainFormHolder left minHeight200">
<legend>Contact Information</legend>
<div class="formsLeft">Title:</div>
<div class="formsRight">
<select name="user_title" class="text-input">';
foreach ($userTitles AS $TitleID=>$TitleName) {
$selected='';
if($_POST['user_title']==$TitleID) $selected=' selected';
$pcontent.='<option value="'.$TitleID.'"'.$selected.'>'.$TitleName.'</option>';
}
$pcontent.='
</select>
</div>
<br />
<div class="formsLeft">First Name:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_firstname" id="user_firstname" value="'.$_POST['user_firstname'].'"'.$JSCripts.' />
</div>
<br />
<div class="formsLeft">Middle Name:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_middlename" id="user_middlename" value="'.$_POST['user_middlename'].'"'.$JSCripts.' />
</div>
<br />
<div class="formsLeft">Last Name:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_lastname" id="user_lastname" value="'.$_POST['user_lastname'].'"'.$JSCripts.' />
</div>
<br />
<div class="formsLeft">Email:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_email" id="user_email" value="'.$_POST['user_email'].'" />
</div>
<br />
<div class="formsLeft">Phone:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_phone" id="user_phone" value="'.$_POST['user_phone'].'" />
</div>
<br />
<div class="formsLeft">Mailing Address:</div>
<div class="formsRight">
<textarea class="text-area-small2rows" name="user_mailing_address" id="user_mailing_address" rows="2" cols="1">'.$_POST['user_mailing_address'].'</textarea>
</div>
<br />
<div class="formsLeft">Postal Code/ZIP:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_postal" id="user_postal" value="'.$_POST['user_postal'].'" />
</div>
<br />
<div class="formsLeft">City:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_city" id="user_city" value="'.$_POST['user_city'].'" />
</div>
<br />
<div class="formsLeft">State/Province:</div>
<div class="formsRight">
<input class="text-input" type="text" name="user_state" id="user_state" value="'.$_POST['user_state'].'" />
</div>
<br />
<div class="formsLeft">Country:</div>
<div class="formsRight">
<select name="user_country" id="user_country" class="text-input">';
//.........这里部分代码省略.........
示例5: getLang
<?php
require_once 'common.php';
check_logged_in();
$PageTitle = getLang('ptitle_logged');
$db = new DBConnection();
$query = 'SELECT user_firstname, trading_type,user_lastname,user_account_num FROM users WHERE user_account_num="' . $_SESSION['user']['user_account_num'] . '" LIMIT 1';
$res = $db->rq($query);
$username = $db->fetch($res);
$total_change = 0;
$total_cost = 0;
$total_value = 0;
$total_profit = 0;
$total_pps_a = 0;
$total_pps_b = 0;
$query = 'SELECT * FROM stock_trades WHERE user_account_num="' . $_SESSION['user']['user_account_num'] . '" AND (trade_type="1" OR trade_type="3") AND trade_status="1" ORDER BY trade_date DESC';
$res = $db->rq($query);
$result = array();
while ($row = $db->fetch($res)) {
$subq = $db->rq("SELECT * FROM stocks WHERE stocks_id='" . $row['stocks_id'] . "' LIMIT 1");
$row['stock'] = $db->fetch($subq);
$subq = $db->rq("SELECT * FROM stock_details WHERE stocks_id='" . $row['stocks_id'] . "' ORDER BY date DESC LIMIT 1");
$row['details'] = $db->fetch($subq);
$total_pps_b += $row['trade_price_share'];
$total_pps_a += $row['details']['value'];
$total_cost += $row['trade_value'];
$row['cur_value'] = $row['details']['value'] * $row['trade_shares_left'];
$total_value += $row['cur_value'];
$row['profit'] = ($row['cur_value'] - $row['trade_value']) / $row['trade_value'] * 100;
if ($row['profit'] > 0) {
$row['profit_class'] = ' class="text-success"';
示例6: addNewCommodity
function addNewCommodity($commodities_id=0) {
if($commodities_id&&!$_POST['_form_submit']) {
$_SESSION['admin']['uedit']=$commodities_id;
$db=new DBConnection();
$query='SELECT * FROM commodities WHERE commodities_id='.($commodities_id+0).'';
$res=$db->rq($query);
foreach ($db->fetch($res) AS $RowName=>$RowValue) {
$_POST[$RowName]=$RowValue;
}
$db->close();
}
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($commodities_id>0)?'Editing':'Creating New').' Commodity</b></div>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/commodities.js"></script>
<form name="addNewCommodity" method="POST" id="MainForms" action="">
<fieldset class="mainFormHolder">
<legend>Commodity information</legend>
<div class="formsLeft">Name:</div>
<div class="formsRight">
<input class="text-input" type="text" name="commodities_name" id="commodities_name" value="'.$_POST['commodities_name'].'" />
</div>
<br />
<div class="formsLeft">Group:</div>
<div class="formsRight">
<select name="commodities_groups_id" class="text-input">';
$db=new DBConnection();
$query='SELECT * FROM commodities_groups ORDER BY commodities_groups_name';
$res=$db->rq($query);
while(($row=$db->fetch($res)) != FALSE) {
$pcontent.='<option value="'.$row['commodities_groups_id'].'"'.(($_POST['commodities_groups_id']==$row['commodities_groups_id'])?' selected':'').'>'.$row['commodities_groups_name'].'</option>';
}
$db->close();
$pcontent.='
</select>
</div>
<br />
<div class="formsLeft">Symbol:</div>
<div class="formsRight">
<input class="text-input" name="commodities_symbol" id="commodities_symbol" value="'.$_POST['commodities_symbol'].'" />
</div>
<br />
<div class="formsLeft">Contract size:</div>
<div class="formsRight">
<input class="text-input" name="commodities_contract_size" id="commodities_contract_size" value="'.$_POST['commodities_contract_size'].'" />
</div>
<br />
<div class="formsLeft">Unit:</div>
<div class="formsRight">
<input class="text-input" name="commodities_unit" id="commodities_unit" value="'.$_POST['commodities_unit'].'" />
</div>
<br />
<div class="formsLeft">Default Fees:</div>
<div class="formsRight">
<input class="text-input" name="commodities_def_fee" id="commodities_def_fee" value="'.$_POST['commodities_def_fee'].'" />
</div>
<br />
<div class="formsLeft">Default Premium Price:</div>
<div class="formsRight">
<input class="text-input" name="commodities_def_prem" id="commodities_def_prem" value="'.$_POST['commodities_def_prem'].'" />
</div>
<br />
<div class="formsLeft">Status:</div>
<div class="formsRight">
<select name="commodities_status" class="text-input">
<option value="0"'.(($_POST['commodities_status']==0)?' selected':'').'>Not active</option>
<option value="1"'.(($_POST['commodities_status']==1)?' selected':'').'>Active</option>
</select>
</div>
<br />
<div class="formsLeft">Order priority:</div>
<div class="formsRight">
<input class="text-input" name="commodities_order_priority" id="commodities_order_priority" value="'.$_POST['commodities_order_priority'].'" />
</div>
<input type="hidden" name="_form_submit" value="1" />
<input type="submit" name="_submit" value="'.getLang('sform_savebtn').'" class="submitBtn ui-state-default" />';
if($commodities_id) {
$pcontent.='
<input type="hidden" name="cid" value="'.$commodities_id.'">
<input type="button" name="_delete" value="'.getLang('sform_delbtn').'" class="submitBtn ui-state-default" onclick="if(confirm(\'Are you sure you want to delete this commodity?\')) location=\'?action=delete&cid='.($_POST['commodities_id']+0).'\';" />';
}
$pcontent.='
<input type="button" name="_cancel" value="'.getLang('sform_backbtn').'" class="submitBtn ui-state-default" onclick="location=\'commodities.php\';" />
</fieldset>
</form>
</div>';
return $pcontent;
}
示例7: DBConnection
}
$pcontent.='</div>';
$db=new DBConnection();
$JSCripts=' onkeyup="setDetails();" onchange="setDetails();"';
$query='SELECT user_balance, user_bank_online,user_bank_beneficiary,user_bank_address,user_bank_account,user_bank_name,user_bank_codetype,user_bank_code,
user_bank_moredetails FROM users WHERE user_account_num="'.($_SESSION['user']['user_account_num']+0).'"';
$res=$db->rq($query);
$row=$db->fetch($res);
foreach ($row as $Column=>$ColumnValue){
$fixColumnName=str_replace('user_', 'tr_', $Column);
$_POST[$fixColumnName]=$ColumnValue;
}
if ($_POST['tr_fees']=='') $_POST['tr_fees']='0.00';
if ($_POST['trade_date']=='') $_POST['trade_date']=date('Y-m-d', CUSTOMTIME);
示例8: resetPasswordAnswer
public function resetPasswordAnswer()
{
$db = new DBConnection();
$return = array();
$query = 'SELECT * FROM users WHERE user_email="' . $db->string_escape($_POST['rform_email']) . '" LIMIT 1';
$res = $db->rq($query);
$row = $db->fetch($res);
if (!isset($row['user_secret_answer'])) {
$return['error'] = getLang('reset_noansw');
} else {
if (strtolower(trim($_POST['rform_answer'])) == strtolower(trim($row['user_secret_answer']))) {
$pattern = '/^[\\_]*([a-z0-9]+(\\.|\\_*)?)+@([a-z][a-z0-9\\-]+(\\.|\\-*\\.))+[a-z]{2,6}$/i';
$check = preg_match($pattern, $_POST['rform_email']);
if ($check == 0) {
$return['error'] = getLang('reset_invalid_email');
} else {
$db = new DBConnection();
$query = 'SELECT u.*, ua1.advisor_names as user_advisor1, ua2.advisor_names as user_advisor2 FROM users u
left join users_advisors ua1 on u.user_advisor1 = ua1.users_advisors_id
left join users_advisors ua2 on u.user_advisor2 = ua2.users_advisors_id
WHERE u.user_email="' . $_POST['rform_email'] . '" LIMIT 1';
$res = $db->rq($query);
$num_rows = $db->num_rows($res);
if ($num_rows > 0) {
$row = $db->fetch($res);
addLog('Front-end', 'Login', '' . $row['user_firstname'] . ' ' . $row['user_lastname'] . ' (' . $row['user_account_num'] . ')', 0, 'Password reset request.');
/*$possible = '0123456789abcdfghjklmnopqrstuvwxyzABCDFGHJKLMNOPQRSTUVWXYZ';
$newpass = '';
$i = 0;
for($i=0;$i<8;$i++) {
$newpass.= substr($possible, mt_rand(0, strlen($possible)-1), 1);
}
$query2='UPDATE users SET user_password="'.$newpass.'", user_passisset=0 WHERE users_id='.($row['users_id']+0).'';
$db->rq($query2);
*/
$query3 = 'SELECT * FROM mail_templates mt LEFT JOIN global_settings gs ON mt.mail_templates_id=gs.variable_value WHERE variable="Forgot password"';
$res3 = $db->rq($query3);
$num_rows3 = $db->num_rows($res3);
if ($num_rows3 > 0) {
$row3 = $db->fetch($res3);
$query4 = 'SELECT * FROM global_settings WHERE section="mail_settings"';
$res4 = $db->rq($query4);
while (($row4 = $db->fetch($res4)) != FALSE) {
if ($row4['variable'] == 'mail_mandrill_host' && $row4['variable_value'] != '') {
$smtp_host = $row4['variable_value'];
}
if ($row4['variable'] == 'mail_mandrill_port' && $row4['variable_value'] != '') {
$smtp_port = $row4['variable_value'];
}
if ($row4['variable'] == 'mail_mandrill_user' && $row4['variable_value'] != '') {
$smtp_user = $row4['variable_value'];
}
if ($row4['variable'] == 'mail_mandrill_password' && $row4['variable_value'] != '') {
$smtp_password = $row4['variable_value'];
}
}
include 'nomad_mimemail.inc.php';
$mimemail = new nomad_mimemail();
$mimemail->set_charset("UTF-8");
if ($row3['mail_from'] != '') {
$mimemail->set_from($row3['mail_from_mail'], $row3['mail_from']);
$mimemail->set_reply_to($row3['mail_from_mail'], $row3['mail_from']);
} else {
$mimemail->set_from($row3['mail_from_mail']);
$mimemail->set_reply_to($row3['mail_from_mail']);
}
$search_for = array('{user_first_name}', '{user_last_name}', '{user_username}', '{user_password}', '{user_password_org}', '{user_account_num}', '{user_account_name}', '{user_admin_ref}', '{user_phone}', '{user_email}', '{user_mailing_address}', '{user_city}', '{user_state}', '{user_postal}', '{user_country}', '{user_advisor1}', '{user_advisor2}', '{user_app_date}');
$replace_with = array($row['user_firstname'], $row['user_lastname'], $row['user_username'], $row['user_password'], $row['user_password'], $row['user_account_num'], $row['user_account_name'], $row['user_ref'], $row['user_phone'], $row['user_email'], $row['user_mailing_address'], $row['user_city'], $row['user_state'], $row['user_postal'], $row['user_country'], $row['user_advisor1'], $row['user_advisor2'], $row['user_app_date']);
$row3['mail_html'] = str_replace($search_for, $replace_with, $row3['mail_html']);
$row3['mail_plain'] = str_replace($search_for, $replace_with, $row3['mail_plain']);
$t_search_for = array('{thanks}');
$t_replace_with_html = array(getLang('mails_thanks_html'));
$t_replace_with_plain = array(getLang('mails_thanks_plain'));
$row3['mail_html'] = str_replace($t_search_for, $t_replace_with_html, $row3['mail_html']);
$row3['mail_plain'] = str_replace($t_search_for, $t_replace_with_plain, $row3['mail_plain']);
$mimemail->set_subject($row3['mail_subject']);
$mimemail->set_html($row3['mail_html']);
$mimemail->set_text($row3['mail_plain']);
$mimemail->set_to($_POST['rform_email'], '' . $row['user_firstname'] . ' ' . $row['user_lastname'] . '');
if ($row3['mail_bcc']) {
$mimemail->set_bcc($row3['mail_bcc']);
}
$mimemail->set_smtp_host($smtp_host, $smtp_port);
$mimemail->set_smtp_auth($smtp_user, $smtp_password);
$mimemail->send();
}
$db->close();
$return['success'] = getLang('rform_newpass');
} else {
$return['error'] = getLang('reset_noemail');
}
}
} else {
//.........这里部分代码省略.........
示例9: addNewTradeShort
function addNewTradeShort($tradesSell_id=0) {
$db=new DBConnection();
if ($tradesSell_id && !isset($_POST['_form_submit'])){
$query='SELECT * FROM stock_trades WHERE trade_ref="'.$tradesSell_id.'"';
$res=$db->rq($query);
$_POST=$db->fetch($res);
$_SESSION['admin']['uedit']=$_POST['trades_id'];
$JSCripts=' onchange="setDetails(0);"';
$JSCriptsSelect=' onchange="setDetails(3);"';
$JSCriptsPremium=' onchange="setDetails(1);"';
}else{
$_POST['trade_stockprice']='0.0000';
$_POST['trade_shares']=10;
$JSCripts=' onchange="setDetails(0);"';
$JSCriptsSelect=' onchange="setDetails(3);"';
$JSCriptsPremium=' onchange="setDetails(1);"';
}
if (array_get($_POST, 'trade_date') == ''){
$_POST['trade_date'] = date('Y-m-d', CUSTOMTIME);
}
global $tradesStatuses;
global $tradesBuyOptions;
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($tradesSell_id>0)?'Editing':'Adding New').' SHORT Order</b></div>
<script type="text/javascript" src="../js/jquery.metadata.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/stradesShort.js"></script>
<script type="text/javascript">
jQuery(document).ready(
function($) {
var sliderValue = '.$_POST['trade_shares'].';
$("#slider").slider( {
min : 1,
max : 99999,
step : 1,
value : [ sliderValue ],
slide : function(event, ui) {
$("#sliderVal").val(ui.value);
}
});
$("#sliderVal").attr("value", sliderValue);
$("#sliderVal").keyup(function() {
var sliderValue = +this.value;
if (sliderValue >= 1 && sliderValue <= 99999) {
$("#slider").slider("value", sliderValue);
} else {
alert("Please enter a value between 1 and 99999");
$("#slider").slider("value", 1);
$("#sliderVal").attr("value", 1);
}
});
$("#slider, #sliderVal").bind("mousedown mouseup mousemove mouseout mouseover", function() {
setDetails(0);
});
'.((!$tradesSell_id)?'setDetails(3);':'setDetails(4);').'
});
</script>
<form name="addNewTradeShort" method="POST" id="MainForms" action="">
<div class="left">
<fieldset class="mainFormHolder left">
<legend>Account</legend>
<div class="formsRight">
<select name="user_account_num" id="user_account_num" class="text-input-big" title="Please select user account!" validate="required:true"'.$JSCripts.'>
<option value="">Select account</option>';
$query='SELECT user_account_num, user_firstname, user_lastname, user_balance FROM users ORDER BY user_firstname ASC, user_lastname ASC';
$res=$db->rq($query);
while (($row=$db->fetch($res))!=FALSE){
$pcontent.='<option value="'.$row['user_account_num'].'"'.((array_get($_GET, 'uid')==$row['user_account_num']||array_get($_POST, 'user_account_num')==$row['user_account_num'])?' selected':'').'>'.$row['user_account_num'].' ('.$row['user_firstname'].' '.$row['user_lastname'].', $'.$row['user_balance'].')</option>';
}
$pcontent.='
</select>
</div>
</fieldset>
<div class="clear"></div>
<fieldset class="mainFormHolder left">
<legend>Transaction</legend>
<div class="formsLeft">Trade Order:</div>
<div class="formsRight">SHORT SELL</div>
<br />
<div class="formsLeft">Share(s):</div>
<div class="formsRight">
<div id="slider"><a href="#"></a></div> <input type="text" class="text-input-smallest left" id="sliderVal" name="trade_shares"'.$JSCripts.' />
</div>
<br /><br />
//.........这里部分代码省略.........
示例10: addNewTradeSell
function addNewTradeSell($tradesSell_id=0) {
$db=new DBConnection();
if ($tradesSell_id&&!$_POST['_form_submit']){
$query='SELECT * FROM trades WHERE trade_ref="'.$tradesSell_id.'"';
$res=$db->rq($query);
$_POST=$db->fetch($res);
$_SESSION['admin']['uedit']=$_POST['trades_id'];
}
$JSCripts=' onchange="setDetails(0);"';
$JSCriptsPremium=' onchange="setDetails(1);"';
if ($_POST['trade_date']=='') $_POST['trade_date']=date('Y-m-d', CUSTOMTIME);
global $tradesSellStatuses;
global $tradesBuyOptions;
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($_GET['action']=='new_sell')?'Adding new':'Editing').' SELL Order</b></div>
<script type="text/javascript" src="../js/jquery.metadata.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/forms/tradesSell.js"></script>
<script type="text/javascript">
jQuery(document).ready(
function($) {
var sliderValue = '.$_POST['trade_positions_left'].';
$("#slider").slider( {
min : 1,
max : '.$_POST['trade_positions_left'].',
step : 1,
value : [ sliderValue ],
slide : function(event, ui) {
$("#sliderVal").val(ui.value);
}
});
$("#sliderVal").attr("value", sliderValue);
$("#sliderVal").keyup(function() {
var sliderValue = +this.value;
if (sliderValue >= 1 && sliderValue <= '.$_POST['trade_positions_left'].') {
$("#slider").slider("value", sliderValue);
} else {
alert("Please enter a value between 1 and '.$_POST['trade_positions_left'].'");
$("#slider").slider("value", 1);
$("#sliderVal").attr("value", 1);
}
});
$("#slider, #sliderVal").bind("mousedown mouseup mousemove mouseout mouseover", function() {
setDetails();
});
setDetails();
});
</script>
<form name="addNewTradeBuy" method="POST" id="MainForms" action="">
<div class="left">
<fieldset class="mainFormHolder left">
<legend>Account</legend>
<div class="formsRight">
<select name="user_account_num" id="user_account_num" class="text-input-big" title="Please select user account!" validate="required:true">';
$query='SELECT user_account_num, user_firstname, user_lastname, user_balance FROM users WHERE user_account_num="'.$_POST['user_account_num'].'" LIMIT 1';
$res=$db->rq($query);
while (($row=$db->fetch($res))!=FALSE){
$pcontent.='<option value="'.$row['user_account_num'].'">'.$row['user_account_num'].' ('.$row['user_firstname'].' '.$row['user_lastname'].', $'.$row['user_balance'].')</option>';
}
$pcontent.='
</select>
</div>
</fieldset>
<div class="clear"></div>
<fieldset class="mainFormHolder left">
<legend>Contract</legend>
<div class="formsLeft">Trade Order:</div>
<div class="formsRight">SELL</div>
<br />
<div class="formsLeft">Position(s):</div>
<div class="formsRight">
<div id="slider"><a href="#"></a></div> <input type="text" class="text-input-smallest left" id="sliderVal" name="trade_positions"'.$JSCripts.' />
</div>
<br /><br />
<div class="formsLeft">Option:</div>
<div class="formsRight"><input class="text-input ui-state-default" type="text" name="trade_option" id="trade_option" value="'.$tradesBuyOptions[$_POST['trade_option']].'"></div>
<br />
<div class="formsLeft">Commodity:</div>
<div class="formsRight">';
$query='SELECT * FROM commodities WHERE commodities_id='.($_POST['commodities_id']+0).' LIMIT 1';
$res=$db->rq($query);
$row=$db->fetch($res);
//.........这里部分代码省略.........
示例11: addNewMailTemplate
function addNewMailTemplate($mail_templates_id=0) {
$db=new DBConnection();
if($mail_templates_id&&!$_POST['_form_submit']) {
$_SESSION['admin']['uedit']=$mail_templates_id;
$query='SELECT * FROM mail_templates WHERE mail_templates_id='.($mail_templates_id+0).'';
$res=$db->rq($query);
foreach ($db->fetch($res) AS $RowName=>$RowValue) {
$_POST[$RowName]=$RowValue;
}
}
$settingsModel = new App\Model\Settings($db, 'mail_settings');
$settings = $settingsModel->getAll();
$API_KEY = $settings['sendwithus_key'];
$options = array();
$api = new API($API_KEY, $options);
$response = $api->emails();
$tags = explode(',', trim($settings['sendwithus_tags']));
$selectTemplateHtml = '<option value="">Empty</option>';
foreach($response as $template)
{
$matched = count(array_filter($tags)) == 0;
foreach($tags as $tag){
if (isset($template->tags) && in_array(trim($tag), $template->tags)) {
$matched = true;
break;
}
}
if($matched){
$selectTemplateHtml .= "<option value='". $template->id ."' ".(isset($_POST['mail_external_id']) && $_POST['mail_external_id'] == "$template->id" ? "selected='selected'" : "") .">". $template->name ."</option>";
}
}
// End
$db->close();
$templateVariables = Array(
'mail_template_title',
'user_first_name',
'user_username',
'user_last_name',
'user_account_num',
'user_password',
'user_password_org',
'trade_details',
'trade_date',
'trade_sell_status',
'trade_buy_status',
'trade_value',
'transfer_value',
'transfer_date',
'thanks',
'company_name',
'site_url',
'funding_overviews',
'trading_overviews',
'trade_ref',
'user_account_name',
'user_admin_ref',
'user_phone',
'user_email',
'user_mailing_address',
'user_city',
'user_state',
'user_postal',
'user_country',
'user_advisor1',
'user_advisor2',
'user_app_date'
);
sort($templateVariables);
$templateVariablesContent = '';
if(count($templateVariables) == 0){
$templateVariablesContent = '<p>Variables are not defined for this template type.</p>';
}else{
$templateVariablesContent .= '<ul class="variable_list">';
foreach($templateVariables as $var){
$templateVariablesContent .= "<li>{{$var}}</li>";
}
$templateVariablesContent .= '</ul>';
}
$pcontent='';
$pcontent.='
<div class="mainHolder">
<div class="hintHolder ui-state-default"><b>'.(($mail_templates_id>0)?'Editing':'Creating New').' Mail Template</b></div>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="js/jquery.simplemodal-1.3.3.min.js"></script>
<link type="text/css" href="css/basic.css" rel="stylesheet" media="screen" />
<script type="text/javascript">
//.........这里部分代码省略.........
示例12: DBConnection
<?php
require_once 'template.php';
page_header(2);
if ($_SESSION['user']['is_logged'] == 1) {
$db = new DBConnection();
$line = array();
$line2 = array();
$query = $db->rq("SELECT value_change, stocks_id FROM stock_details ORDER BY date DESC, value_change DESC LIMIT 2");
while ($details = $db->fetch($query)) {
$subq = $db->rq("SELECT stocks_symbol, stocks_name FROM stocks WHERE stocks_id='" . $details['stocks_id'] . "' LIMIT 1");
$stock = $db->fetch($subq);
$stock['stocks_name'] = stripslashes($stock['stocks_name']);
$line[$stock['stocks_name']] = $details['value_change'];
}
$query = $db->rq("SELECT value_change, stocks_id FROM stock_details ORDER BY date DESC, value_change ASC LIMIT 2");
while ($details = $db->fetch($query)) {
$subq = $db->rq("SELECT stocks_symbol, stocks_name FROM stocks WHERE stocks_id='" . $details['stocks_id'] . "' LIMIT 1");
$stock = $db->fetch($subq);
$stock['stocks_name'] = stripslashes($stock['stocks_name']);
$line2[$stock['stocks_name']] = $details['value_change'];
}
?>
<script type="text/javascript">
$(document).ready(function(){
var line1 = [
示例13: getLang
<td><b>' . getLang('log_admin') . '</b></td>
<td><b>' . getLang('log_detail') . '</b></td>
<td><b>' . getLang('log_date') . '</b></td>
<td><b>' . getLang('log_ip') . '</b></td>
</tr>
</thead>';
$db = new DBConnection();
$query = 'SELECT * FROM logs WHERE log_user LIKE "%' . $_SESSION['user']['user_account_num'] . '%" ORDER BY logs_id DESC';
$res = $db->rq($query);
$count = 1;
while (($row = $db->fetch($res)) != FALSE) {
$trclass = 'odd';
if ($count % 2 == 1) {
$trclass = 'even';
}
echo '
<tr class="' . $trclass . '">
<td>' . $row['logs_id'] . '</td>
<td>' . $row['log_area'] . '</td>
<td>' . $row['log_section'] . '</td>
<td>' . $row['log_user'] . '</td>
示例14: DBConnection
<?php
require '../vendor/autoload.php';
require_once '../classes/db.class.php';
require_once '../includes/timefix.php';
set_time_limit(900);
$db = new DBConnection();
$today = date('Y-m-d', CUSTOMTIME);
$query = 'UPDATE trades SET trade_status=4 WHERE trade_expiry_date<"' . $today . '" AND trade_status=1';
$db->rq($query);
$query = 'SELECT user_account_num, user_lscp, user_lscp FROM users WHERE user_status=1';
$res = $db->rq($query);
while (($row = $db->fetch($res)) != FALSE) {
$query2 = 'SELECT MIN(trade_strikeprice) AS min_strike FROM trades WHERE trade_status=1 AND trade_option=1 AND user_account_num="' . $row['user_account_num'] . '"';
$res2 = $db->rq($query2);
$row2 = $db->fetch($res2);
if ($row2['min_strike'] < $row['user_lscp'] || $row['user_lscp'] == 0) {
$query3 = 'UPDATE users SET user_lscp="' . ($row2['min_strike'] + 0) . '", user_lastupdate="' . date('Y-m-d H:i:s', CUSTOMTIME) . '"
WHERE user_account_num="' . $row['user_account_num'] . '"';
$db->rq($query3);
}
$query4 = 'SELECT MAX(trade_strikeprice) AS max_strike FROM trades WHERE trade_status=1 AND trade_option=2 AND user_account_num="' . $row['user_account_num'] . '"';
$res4 = $db->rq($query4);
$row4 = $db->fetch($res4);
if ($row4['max_strike'] > $row['user_hpsp'] || $row['user_hpsp'] == 0) {
$query5 = 'UPDATE users SET user_hpsp="' . ($row4['max_strike'] + 0) . '", user_lastupdate="' . date('Y-m-d H:i:s', CUSTOMTIME) . '"
WHERE user_account_num="' . $row['user_account_num'] . '"';
$db->rq($query5);
}
$query6 = 'SELECT COUNT(trades_id) AS total_trades FROM trades WHERE trade_status=1 AND user_account_num="' . $row['user_account_num'] . '"';
$res6 = $db->rq($query6);
示例15: DBConnection
<body>
<div id="top">
<div style="text-align:center;margin: 10px auto;color:#000000;width:300px;" id="BaseHolder">
<img src="/images/lploader.gif" border="0"><br />
<b>Attempting to send mails, please wait...</b>
</div>';
$db=new DBConnection();
if($_GET['action']=='single'&&($_GET['mailid']+0)>0) {
$query='SELECT * FROM mail_queue WHERE mail_queue_id='.($_GET['mailid']+0).' AND is_sent=0';
$res=$db->rq($query);
$num_rows=$db->num_rows($res);
if($num_rows>0) {
$row=$db->fetch($res);
$settingsModel = new App\Model\Settings($db, 'mail_settings');
$settings = $settingsModel->getAll();
$transport = $settings['mail_transport'];
$smtp_host = $settings['mail_' . $transport . '_host'];
$smtp_port = $settings['mail_' . $transport . '_port'];
$smtp_user = $settings['mail_' . $transport . '_user'];
$smtp_password = $settings['mail_' . $transport . '_password'];
include ('../includes/nomad_mimemail.inc.php');
$mimemail = new nomad_mimemail();
$mimemail->set_charset("UTF-8");