Example #1
0
 function syncredit($arr)
 {
     if (is_array($arr)) {
         foreach ($arr as $uid => $setv) {
             $updateMemberData = array();
             foreach ($setv as $cid => $value) {
                 if (is_numeric($cid)) {
                     $value = intval($value);
                     /**
                     						$this->db->pw_update(
                     							"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) .  ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
                     						);
                     						**/
                     $this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
                 } elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
                     $cid == 'rvrc' && ($value *= 10);
                     $updateMemberData[$cid] = intval($value);
                 }
             }
             if ($updateMemberData) {
                 $userService = L::loadClass('UserService', 'user');
                 /* @var $userService PW_UserService */
                 $userService->update($uid, array(), $updateMemberData);
             }
         }
     }
     return new ApiResponse(1);
 }
Example #2
0
         $u_credit = $credit->get($rt['uid'], 'CUSTOM');
         include PrintEot('usermanage');
         exit;
     } else {
         S::gp(array('uid', 'creditdb'), 'P');
         !is_numeric($uid) && adminmsg('operate_error');
         foreach ($creditdb as $key => $value) {
             if (is_numeric($key) && is_numeric($value)) {
                 /**
                 					$db->pw_update(
                 						"SELECT uid FROM pw_membercredit WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key),
                 						"UPDATE pw_membercredit SET value=".S::sqlEscape($value)."WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key),
                 						"INSERT INTO pw_membercredit SET ".S::sqlSingle(array('uid'=>$uid,'cid'=>$key,'value'=>$value))
                 					);
                 					**/
                 $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . "AND cid=" . S::sqlEscape($key), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $key), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $key, 'value' => $value)));
             }
         }
         adminmsg('operate_success');
     }
 } else {
     S::gp(array('page'), 'GP', 2);
     $page < 1 && ($page = 1);
     $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage);
     $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_membercredit WHERE value!=0");
     $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_perpage), "{$basename}&");
     $query = $db->query("SELECT m.uid,m.username,mc.cid,mc.value FROM pw_membercredit mc LEFT JOIN pw_members m USING(uid) WHERE value!=0 ORDER BY cid, value DESC {$limit}");
     while ($rt = $db->fetch_array($query)) {
         $rt['name'] = $_CREDITDB[$rt['cid']][0];
         $creditdb[] = $rt;
     }
Example #3
0
 function _insertUser()
 {
     global $timestamp, $onlineip, $credit;
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'username' => $this->data['username'],
     			'password' => $this->data['password'],
     			'safecv' => $this->data['safecv'],
     			'email' => $this->data['email'],
     			'groupid' => $this->data['groupid'],
     			'memberid' => $this->data['memberid'],
     			'regdate' => $timestamp,
     			'yz' => $this->data['yz'],
     			'userstatus' => $this->data['userstatus'],
     			'newpm' => 0
     		));
     		$this->db->update("REPLACE INTO pw_members SET $pwSQL");
     		**/
     $pwSQL = array('uid' => $this->uid, 'username' => $this->data['username'], 'password' => $this->data['password'], 'safecv' => $this->data['safecv'], 'email' => $this->data['email'], 'groupid' => $this->data['groupid'], 'memberid' => $this->data['memberid'], 'regdate' => $timestamp, 'yz' => $this->data['yz'], 'userstatus' => $this->data['userstatus'], 'newpm' => 0);
     pwQuery::replace('pw_members', $pwSQL);
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'postnum' => 0,
     			'lastvisit' => $timestamp,
     			'thisvisit' => $timestamp,
     			'onlineip' => $onlineip
     		));
     		$this->db->pw_update(
     			'SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid),
     			'UPDATE pw_memberdata SET ' . $pwSQL . ' WHERE uid=' . S::sqlEscape($this->uid),
     			'INSERT INTO pw_memberdata SET ' . $pwSQL
     		);
     		**/
     $pwSQL = array('uid' => $this->uid, 'postnum' => 0, 'lastvisit' => $timestamp, 'thisvisit' => $timestamp, 'onlineip' => $onlineip);
     $this->db->pw_update('SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid), pwQuery::updateClause('pw_memberdata', 'uid =:uid', array($this->uid), $pwSQL), pwQuery::insertClause('pw_memberdata', $pwSQL));
     //$this->db->update("REPLACE INTO pw_memberdata SET $pwSQL");
     require_once R_P . 'require/credit.php';
     $credit->addLog('reg_register', L::reg('rg_regcredit'), array('uid' => $this->uid, 'username' => stripslashes($this->data['username']), 'ip' => $onlineip));
     $credit->sets($this->uid, L::reg('rg_regcredit'), false);
     $credit->runsql();
     //* $this->db->update("UPDATE pw_bbsinfo SET newmember=" . S::sqlEscape($this->data['username']) . ",totalmember=totalmember+1 WHERE id='1'");
     $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET newmember=:newmember,totalmember=totalmember+1 WHERE id=:id", array('pw_bbsinfo', $this->data['username'], 1)));
     $this->memberinfo or $this->memberinfo['uid'] = $this->uid;
     if ($this->memberinfo) {
         /**
         			$this->db->update("REPLACE INTO pw_memberinfo SET uid=" . S::sqlEscape($this->uid) . ',' . S::sqlSingle($this->memberinfo));
         			**/
         $_temp = array('uid' => $this->uid) + $this->memberinfo;
         pwQuery::replace('pw_memberinfo', $_temp);
     }
     $statistics = L::loadClass('Statistics', 'datanalyse');
     $statistics->register();
 }
Example #4
0
            				"SELECT * FROM pw_singleright WHERE uid=" . S::sqlEscape($uid),
            				"UPDATE pw_singleright SET" . S::sqlSingle(array(
            						'visit'	=> $visit,
            						'post'	=> $post,
            						'reply'	=> $reply
            					))
            				. " WHERE uid=" . S::sqlEscape($uid),
            				"INSERT INTO pw_singleright SET" . S::sqlSingle(array(
            					'uid'	=> $uid,
            					'visit'	=> $visit,
            					'post'	=> $post,
            					'reply'	=> $reply
            				))
            			);
            			**/
            $db->pw_update("SELECT * FROM pw_singleright WHERE uid=" . S::sqlEscape($uid), pwQuery::updateClause('pw_singleright', 'uid =:uid', array($uid), array('visit' => $visit, 'post' => $post, 'reply' => $reply)), pwQuery::insertClause('pw_singleright', array('uid' => $uid, 'visit' => $visit, 'post' => $post, 'reply' => $reply)));
            adminmsg('operate_success');
        }
    } elseif ($_POST['job'] == 'del') {
        S::gp(array('selid'), 'P');
        $tmpSelid = $selid;
        if (!($selid = checkselid($selid))) {
            adminmsg('operate_error');
        }
        //* $db->update("DELETE FROM pw_singleright WHERE uid IN($selid)");
        pwQuery::delete('pw_singleright', 'uid IN (:uid)', array($tmpSelid));
        adminmsg('operate_success');
    }
} elseif ($action == 'user') {
    //* include_once pwCache::getPath(D_P.'data/bbscache/level.php');
    //* include_once pwCache::getPath(D_P.'data/bbscache/forumcache.php');
Example #5
0
 function update($tableName, $where_statement = null, $where_conditions = null, $col_names, $expand = null)
 {
     $GLOBALS['db']->update(pwQuery::updateClause($tableName, $where_statement, $where_conditions, $col_names, $expand));
     return $GLOBALS['db']->affected_rows();
 }