示例#1
0
 function edit($uid, $username, $pwd, $email)
 {
     $user = $this->get_by_uid($uid);
     $ucsql = array();
     $retv = 0;
     if ($username && $user['username'] != $username) {
         $ucsql['username'] = $username;
         $retv++;
     }
     if ($pwd && $user['password'] != md5($pwd)) {
         $ucsql['password'] = md5($pwd);
     }
     if ($email && $user['email'] != $email) {
         $ucsql['email'] = $email;
     }
     if ($ucsql) {
         $retv++;
         $this->db->update("UPDATE " . UC_DBTABLEPRE . "members SET " . UC::sqlSingle($ucsql) . ' WHERE uid=' . UC::escape($uid));
     }
     return $retv;
 }
示例#2
0
文件: notify.php 项目: noikiy/ecmall
 function send_by_id($nid)
 {
     $data = $this->get_by_id($nid);
     if ($data && !$data['complete']) {
         $pwSQL = array();
         $myApp = $this->base->load('app');
         $applist = $myApp->applist();
         foreach ($applist as $key => $app) {
             if ($data['app' . $key] < 1) {
                 $resp = $myApp->ucfopen($app['siteurl'], $app['interface'], $app['secretkey'], $this->operations[$data['action']][0], $this->operations[$data['action']][1], $data['param'] ? unserialize($data['param']) : array());
                 if (isset($resp['result'])) {
                     $data['app' . $key] = 1;
                     $pwSQL['app' . $key] = 1;
                 }
             }
         }
         $pwSQL['complete'] = $this->isComplete($data, $applist) ? 1 : 0;
         $this->db->query_unbuffered("UPDATE " . UC_DBTABLEPRE . "ucnotify SET " . UC::sqlSingle($pwSQL) . ' WHERE nid=' . UC::escape($nid));
     }
 }
示例#3
0
 function add($uid, $cid, $value, $isAdd = true)
 {
     $cid == 'rvrc' && ($value *= 10);
     $value = intval($value);
     if (is_numeric($cid)) {
         $rt = $this->db->get_one("SELECT uid,value FROM " . UC_DBTABLEPRE . "membercredit WHERE uid=" . UC::escape($uid) . ' AND cid=' . UC::escape($cid));
         if ($rt) {
             if ($isAdd) {
                 $this->db->update("UPDATE " . UC_DBTABLEPRE . "membercredit SET value=value+" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid) . ' AND cid=' . UC::escape($cid));
                 return $rt['value'] + $value;
             } else {
                 $this->db->update("UPDATE " . UC_DBTABLEPRE . "membercredit SET value=" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid) . ' AND cid=' . UC::escape($cid));
                 return $value;
             }
         } else {
             $this->db->update("INSERT INTO " . UC_DBTABLEPRE . "membercredit SET " . UC::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
             return $value;
         }
     } elseif ($this->isAllow($cid)) {
         if ($isAdd) {
             $this->db->update("UPDATE " . UC_DBTABLEPRE . "memberdata SET {$cid}={$cid}+" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid));
             $cid == 'rvrc' && ($cid = "FLOOR(rvrc/10)");
             return $this->db->get_value("SELECT {$cid} FROM " . UC_DBTABLEPRE . "memberdata WHERE uid=" . UC::escape($uid));
         } else {
             $this->db->update("UPDATE " . UC_DBTABLEPRE . "memberdata SET {$cid}=" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid));
             $cid == 'rvrc' && ($value /= 10);
             return $value;
         }
     }
     return null;
 }