本文整理汇总了PHP中dbc函数的典型用法代码示例。如果您正苦于以下问题:PHP dbc函数的具体用法?PHP dbc怎么用?PHP dbc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Clear
public function Clear($type, $timeBefore)
{
$where = array();
$type != '*' && $where['type'] = $type;
$where['time'] = array('<', time() - (float)$timeBefore);
return dbc(DBCMax)->delete('zlog')->where($where)->done();
}
示例2: del_image
public function del_image() {
$this->CheckAdminPrivs('seller');
$seller_id = get('seller_id', 'int');
$id = get('id', 'int');
if($seller_id > 0 && $id > 0) {
$s = logic('seller')->GetOne($seller_id);
if($s) {
if ($s['imgs'] == '')
{
logic('upload')->Delete($id);
}
else
{
$imgs = explode(',', $s['imgs']);
foreach ($imgs as $i => $iid)
{
if ($iid == $id)
{
logic('upload')->Delete($id);
unset($imgs[$i]);
}
}
$new = implode(',', $imgs);
dbc(DBCMax)->update('seller')->data(array('imgs'=>$new))->where(array('id'=>$seller_id))->done();
}
}
}
exit('ok');
}
示例3: add_score
public function add_score($pid=0,$uid=0,$score=0,$type='buy',$share=''){
$info = '';
if(!in_array($type,array('buy','reply','forward'))){
$type='buy';
}
if($type != 'buy'){
$set_scores = ini('credits.config');
$score = (int)$set_scores[$type];
}
$products = dbc(DBCMax)->select('product')->in('name')->where('`id`='. (int)$pid)->limit(1)->done();
if($products['name']){
if($type == 'buy'){
$info = '购买产品:'.$products['name'];
}elseif($type == 'reply'){
$info = '评论产品:'.$products['name'];
}elseif($type == 'forward' && $share && $uid > 0){
$chx = dbc(DBCMax)->select('credit')->where(array('uid'=>$uid,'pid'=>$pid,'type'=>'forward'))->limit(1)->done();
if(!$chx){
$info = '分享产品:'.$products['name'].' 到:'.$share;
}
}
}
if($uid > 0 && $score > 0 && $info){
$data = array(
'uid' => $uid,
'pid' => $pid,
'info' => $info,
'score'=> $score,
'type' => $type,
'gettime' => time(),
);
dbc(DBCMax)->insert('credit')->data($data)->done();
dbc(DBCMax)->update('members')->data('scores=scores+'.$score)->where('uid='.(int)$uid)->done();
}
}
示例4: CallbackVerify
public function CallbackVerify($payment)
{
if (user()->get('id') < 1)
{
return 'VERIFY_FAILED';
}
$password = post('password', 'txt');
$market_account = dbc(DBCMax)->select('members')->where(array('uid'=>MEMBER_ID))->limit(1)->done();
$fromisqq = explode('.', $market_account['email2']);
if($market_account['email2']=='zuitu'){
$validate = md5($password.'@4!@#$%@') != user()->get('password');
}elseif($fromisqq[1] == 'qq'){
$validate = md5(md5($password)) != user()->get('password');
}else{
$validate = md5($password) != user()->get('password');
}
if ($validate)
{
return 'VERIFY_FAILED';
}
$trade = $this->GetTradeData();
if ($trade['__order__']['paytype'] != $payment['id'])
{
return 'VERIFY_FAILED';
}
return $trade['status'];
}
示例5: save
public function save()
{
$this->CheckAdminPrivs('privs');
$uid = post('uid', 'int');
if($uid == '1'){
$this->Messager("您不能对此管理员的权限进行任何操作");
}
$userinfo = dbc(DBCMax)->query('select uid,username,role_id,role_type,privs from '.table('members').' where uid='.$uid)->limit(1)->done();
if(!$userinfo){
$this->Messager("该用户不存在");
}
if(!in_array($userinfo['role_type'],array('admin','seller'))){
$this->Messager("您不能设置该用户的后台操作权限");
}
$privs = post('privs_code');
if($privs && is_array($privs)){
$privs[] = 'index';
$dataprivs = implode(',',$privs);
}else{
$dataprivs = '';
}
if($dataprivs != $userinfo['privs']){
dbc(DBCMax)->update('members')->data(array('privs'=>$dataprivs,'role_id'=>'0'))->where('uid='.$uid)->done();
}
$this->Messager("权限设置成功");
}
示例6: place
public function place()
{
$this->CheckAdminPrivs('city');
$cityId = get('cid', 'int');
$city = dbc(DBCMax)->select('city')->where(array('cityid' => $cityId))->limit(1)->done();
$places = logic('city')->get_places($cityId);
include handler('template')->file('@admin/city_place_list');
}
示例7: get_one
public function get_one($id, $is = 'sign') {
$id = (is_numeric($id) ? $id : 0);
if($id < 1) {
return false;
}
$is = (in_array($is, array('id', 'sign', 'trade_no')) ? $is : 'sign');
return dbc(DBCMax)->select('paylog')->where(array($is => $id))->order(" `id` DESC ")->limit(1)->done();
}
示例8: Log_clear
public function Log_clear()
{
$this->CheckAdminPrivs('push');
$_POST['clear_time'] = 7;
$_POST['clear_unit'] = 'd';
$_POST['clear_type'] = 'out';
$sql_limit_time = 'type="mail" AND `update` '.$this->__sql_clear_time();
$sql = 'DELETE FROM '.table('push_log').' WHERE '.$sql_limit_time;
dbc()->Query($sql);
$this->Messager('操作完成!', '?mod=push&code=log');
}
示例9: zlogCreate
protected function zlogCreate($index, $name, $extra = '')
{
$data = array(
'type' => $this->zlogType,
'uid' => user()->get('id'),
'uip' => ip2long(client_ip()),
'index' => $index,
'name' => $name,
'extra' => $extra,
'time' => time()
);
return dbc(DBCMax)->insert('zlog')->data($data)->done();
}
示例10: init
public function init()
{
$sellers = dbc(DBCMax)->select('seller')->done();
foreach ($sellers as $seller)
{
list($longitude, $latitude, $level) = explode(',', $seller['sellermap']);
if ($longitude && $latitude)
{
dbc(DBCMax)->update('product')->where(array('sellerid' => $seller['id']))->data(array('longitude' => (float)$longitude, 'latitude' => (float)$latitude))->done();
dbc(DBCMax)->update('seller')->where(array('id' => $seller['id']))->data(array('longitude' => (float)$longitude, 'latitude' => (float)$latitude))->done();
}
}
}
示例11: MemberHandler
function MemberHandler()
{
$this->DatabaseHandler =dbc();
$this->CookieHandler =handler('cookie');
$this->Config =ini('settings');
$this->ID =0;
$this->MemberName ='';
$this->MemberPassword ='';
$this->ActionList ='';
$this->CurrentActions ='';
$this->setSessionId();
}
示例12: Set
public function Set()
{
$path = get('path', 'txt');
$data = get('data');
list($search, $field) = explode('/', $path);
list($sWhere, $sTable) = explode('@', $search);
list($sField, $sValue) = explode(':', $sWhere);
$sql = 'UPDATE `'.table($sTable).'` SET `'.$field.'`='.(is_numeric($data) ? $data : '"'.$data.'"').' WHERE `'.$sField.'`='.(is_numeric($sValue) ? $sValue : '"'.$sValue.'"');
dbc()->Query($sql);
if($sTable == 'seller' && $field == 'enabled'){
logic('seller')->setmembertype($sValue,$data);
}
exit('end');
}
示例13: Checkout_save
function Checkout_save()
{
$product_id = post('product_id', 'int');
$product = logic('product')->BuysCheck($product_id);
if (isset($product['false']))
{
return $this->__ajax_save_failed($product['false']);
}
$num_buys = post('num_buys', 'int');
if (!$num_buys || ($product['oncemax'] > 0 && $num_buys > $product['oncemax']) || $num_buys < $product['oncemin'])
{
return $this->__ajax_save_failed(__('请填写正确的购买数量!'));
}
$order = logic('order')->GetFree(user()->get('id'), $product_id);
$order['productnum'] = $num_buys;
$order['productprice'] = $product['nowprice'];
$order['extmsg'] = post('extmsg', 'txt');
if ($product['type'] == 'stuff')
{
logic('address')->Accessed('order.save', $order); logic('express')->Accessed('order.save', $order); }
logic('notify')->Accessed('order.save', $order);
if (!logic('attrs')->Accessed('order.save', $order))
{
return $this->__ajax_save_failed(__('请选择正确的产品属性规格!'));
}
$price_total = $order['productprice'] * $order['productnum'] + $order['expressprice'];
logic('attrs')->order_calc($order['orderid'], $price_total);
if ((float)$price_total < 0)
{
return $this->__ajax_save_failed(__('订单总价不正确,请重新下单!'));
}
$order['totalprice'] = $price_total;
$order['process'] = '__CREATE__';
$order['status'] = ORD_STA_Normal;
if( $product['is_countdown'] == 1 ){
$order['is_countdown'] = 1;
dbc(DBCMax)->update('product')->data('sells_count=sells_count+'.(int)$num_buys)->where('id='.$product_id)->done(); }
logic('order')->Update($order['orderid'], $order);
$ops = array(
'status' => 'ok',
'id' => $order['orderid']
);
if (!X_IS_AJAX)
{
header('Location: '.rewrite('?mod=buy&code=order&id='.$order['orderid']));
exit;
}
echo jsonEncode($ops);
}
示例14: get_first_user_time
private function get_first_user_time($hoster)
{
$order = dbc(DBCMax)->select('order')->where(array('userid' => $hoster))->order('paytime.asc')->limit(1)->done();
$recharge = dbc(DBCMax)->select('recharge_order')->where(array('userid' => $hoster))->order('paytime.asc')->limit(1)->done();
$order || $order = array('paytime' => time() + 7052991);
$recharge || $recharge = array('paytime' => time() + 7052991);
if (($order['paytime'] == $recharge['paytime']) && $order['paytime'] > time())
{
return 0;
}
else
{
return min(array($order['paytime'], $recharge['paytime']));
}
}
示例15: MasterObject
function MasterObject(&$config)
{
$config['v'] = SYS_VERSION;
$this->Config=$config;
$this->Get = &$_GET;
$this->Post = &$_POST;
$this->Cookie = &$_COOKIE;
$this->Session = &$_SESSION;
$this->Request = &$_REQUEST;
$this->Server = &$_SERVER;
$this->Files = &$_FILES;
$this->Module = $this->Post['mod']?$this->Post['mod']:$this->Get['mod'];
$this->Code = $this->Post['code']?$this->Post['code']:$this->Get['code'];
$this->OPC = trim($this->Post['op']?$this->Post['op']:$this->Get['op']);
$GLOBALS['iframe'] = '';
$ipbanned=ConfigHandler::get('access','ipbanned');
if(!empty($ipbanned) && preg_match("~^({$ipbanned})~",$_SERVER['REMOTE_ADDR']))
{
die(__("您的IP已经被禁止访问。"));
}
$this->TemplateHandler=new TemplateHandler($config);
Obj::register('TemplateHandler',$this->TemplateHandler);
$this->CookieHandler = handler('cookie');
$this->DatabaseHandler = dbc();
Obj::register('DatabaseHandler',$this->DatabaseHandler);
Obj::register('CookieHandler',$this->CookieHandler);
Obj::register('config',$this->Config);
}