本文整理汇总了PHP中credit_add函数的典型用法代码示例。如果您正苦于以下问题:PHP credit_add函数的具体用法?PHP credit_add怎么用?PHP credit_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了credit_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
$username = trim($username);
if (!$username) {
continue;
}
$r = $db->get_one("SELECT username,credit FROM {$DT_PRE}member WHERE username='{$username}'");
if (!$r) {
$error .= '<br/>会员[' . $username . ']不存在';
continue;
}
if (!$type && $r['credit'] < abs($amount)) {
$error .= '<br/>会员[' . $username . ']' . $DT['credit_name'] . '不足,当前' . $DT['credit_name'] . '为:' . $r['credit'];
continue;
}
$reason or $reason = '奖励';
$note or $note = '手工';
credit_add($username, $amount);
credit_record($username, $amount, $_username, $reason, $note);
}
if ($error) {
message('操作成功 ' . $success . ' 位会员,发生以下错误:' . $error);
}
dmsg('操作成功', '?moduleid=' . $moduleid . '&file=' . $file);
} else {
if (isset($userid)) {
if ($userid) {
$userids = is_array($userid) ? implode(',', $userid) : $userid;
$result = $db->query("SELECT username FROM {$DT_PRE}member WHERE userid IN ({$userids})");
while ($r = $db->fetch_array($result)) {
$username .= $r['username'] . "\n";
}
}
示例2: credit_add
if ($could_refresh && $MOD['credit_refresh'] && $MOD['credit_refresh'] > $_credit) {
$could_refresh = false;
}
if ($could_refresh) {
$do->refresh($itemid);
$s++;
if ($MOD['credit_refresh']) {
$_credit = $_credit - $MOD['credit_refresh'];
}
} else {
$f++;
}
}
if ($MOD['credit_refresh'] && $s) {
$credit = $s * $MOD['credit_refresh'];
credit_add($_username, -$credit);
credit_record($_username, -$credit, 'system', lang($L['credit_record_refresh'], array($MOD['name'])), lang($L['refresh_total'], array($s)));
}
$msg = lang($L['refresh_success'], array($s));
if ($f) {
$msg = $msg . ' ' . lang($L['refresh_fail'], array($f));
}
dmsg($msg, $forward);
break;
default:
$_process = $L['group_process'];
$sorder = $L['group_orderby'];
$dorder = array($MOD['order'], 'orders DESC', 'orders ASC', 'sales DESC', 'sales ASC', 'price DESC', 'price ASC', 'marketprice DESC', 'marketprice ASC', 'savemoney DESC', 'savemoney ASC', 'discount DESC', 'discount ASC', 'amount DESC', 'amount ASC', 'minamount DESC', 'minamount ASC', 'hits DESC', 'hits ASC');
isset($order) && isset($dorder[$order]) or $order = 0;
$status = isset($status) ? intval($status) : 3;
in_array($status, array(1, 2, 3, 4)) or $status = 3;
示例3: check
function check($itemid)
{
global $_username, $DT_TIME, $MOD;
if (is_array($itemid)) {
foreach ($itemid as $v) {
$this->check($v);
}
} else {
$this->itemid = $itemid;
$item = $this->get_one();
if ($MOD['credit_add'] && $item['username'] && $item['hits'] < 1) {
credit_add($item['username'], $MOD['credit_add']);
credit_record($item['username'], $MOD['credit_add'], 'system', lang('my->credit_record_add', array($MOD['name'])), 'ID:' . $this->itemid);
}
$editdate = timetodate($DT_TIME, 3);
$this->db->query("UPDATE {$this->table} SET status=3,hits=hits+1,editor='{$_username}',edittime={$DT_TIME} WHERE itemid={$itemid}");
$this->tohtml($itemid);
return true;
}
}
示例4: dheader
if (!$_userid) {
dheader($MOD['linkurl']);
}
if (!$mid || !$itemid || !$fee || !$currency || !$sign || !$title || !$forward) {
dheader($MOD['linkurl']);
}
$title = rawurldecode($title);
check_sign($_username . $mid . $itemid . $username . $fee . $fee_back . $currency . $forward . $title, $sign) or dalert($L['check_sign'], $forward);
$note = ($mid == -9 ? $L['resume_name'] : $MODULE[$mid]['name']) . '/' . $itemid;
if ($currency == 'credit') {
if ($_credit >= $fee) {
$db->query("INSERT INTO {$DT_PRE}finance_pay (moduleid,itemid,username,fee,currency,paytime,ip,title) VALUES ('{$mid}','{$itemid}','{$_username}','{$fee}','{$currency}','{$DT_TIME}','{$DT_IP}','" . addslashes($title) . "')");
credit_add($_username, -$fee);
credit_record($_username, -$fee, 'system', $L['pay_record_view'], $note);
if ($username && $fee_back) {
credit_add($username, $fee_back);
credit_record($username, $fee_back, 'system', $L['pay_record_back'], $note);
}
dheader($forward);
} else {
dheader($MOD['linkurl'] . 'credit.php?action=buy');
}
}
$discount = $MG['discount'] > 0 && $MG['discount'] < 100 ? $MG['discount'] : 100;
$discount = dround($discount / 100);
if ($submit) {
is_payword($_username, $password) or message($L['error_payword']);
$fee = dround($fee * $discount);
$fee > 0 or message($L['pay_msg_fee']);
$fee <= $_money or dheader($MOD['linkurl'] . 'charge.php?action=pay&amount=' . ($fee - $_money));
$db->query("INSERT INTO {$DT_PRE}finance_pay (moduleid,itemid,username,fee,currency,paytime,ip,title) VALUES ('{$mid}','{$itemid}','{$_username}','{$fee}','{$currency}','{$DT_TIME}','{$DT_IP}','" . addslashes($title) . "')");
示例5: fields_update
if ($MFD) {
fields_update($post_fields, $do->table_member, $do->userid, 'userid', $MFD);
}
if ($CFD) {
fields_update($post_fields, $do->table_company, $do->userid, 'userid', $CFD);
}
if ($user['edittime'] == 0 && $user['inviter'] && $MOD['credit_user']) {
$inviter = $user['inviter'];
$r = $db->get_one("SELECT itemid FROM {$DT_PRE}finance_credit WHERE note='{$_username}' AND username='{$inviter}'");
if (!$r) {
credit_add($inviter, $MOD['credit_user']);
credit_record($inviter, $MOD['credit_user'], 'system', $L['edit_invite'], $_username);
}
}
if ($user['edittime'] == 0 && $MOD['credit_edit']) {
credit_add($_username, $MOD['credit_edit']);
credit_record($_username, $MOD['credit_edit'], 'system', $L['edit_profile'], $DT_IP);
}
if ($post['password']) {
message($L['edit_msg_success'] . $L['edit_msg_password'], '?tab=' . $tab . '&success=1');
}
dmsg($L['edit_msg_success'], '?tab=' . $tab . '&success=1');
} else {
message($do->errmsg);
}
} else {
$COM_TYPE = explode('|', $MOD['com_type']);
$COM_SIZE = explode('|', $MOD['com_size']);
$COM_MODE = explode('|', $MOD['com_mode']);
$MONEY_UNIT = explode('|', $MOD['money_unit']);
$head_title = $L['edit_title'];
示例6: delete
function delete($itemid, $all = true)
{
global $MOD, $L;
if (is_array($itemid)) {
foreach ($itemid as $v) {
$this->delete($v);
}
} else {
$this->itemid = $itemid;
$r = $this->get_one();
$userid = get_user($r['username']);
if ($r['content']) {
delete_local($r['content'], $userid);
}
$this->db->query("DELETE FROM {$this->table} WHERE itemid={$itemid}");
$this->db->query("DELETE FROM {$this->table_data} WHERE itemid={$itemid}");
if ($r['username'] && $MOD['credit_del_page']) {
credit_add($r['username'], -$MOD['credit_del_page']);
credit_record($r['username'], -$MOD['credit_del_page'], 'system', $L['page_record_del'], 'ID:' . $this->itemid);
}
}
}
示例7: credit_hook_rate_deductusercredit
function credit_hook_rate_deductusercredit($uid, $amount)
{
// the amount is always negative to reduce balance
$amount = -1 * abs($amount);
return credit_add($uid, $amount);
}
示例8: isset
}
}
}
}
$fid = isset($fid) ? $fid : '';
if (isset($old) && $old && in_array($from, array('thumb', 'photo'))) {
delete_upload($old, $_userid);
}
$_saveto = $swfupload ? str_replace('.thumb.' . $do->ext, '', $saveto) : $saveto;
$_SESSION['uploads'][] = $_saveto;
if ($DT['uploadlog']) {
$db->query("INSERT INTO {$upload_table} (item,fileurl,filesize,fileext,upfrom,width,height,moduleid,username,ip,addtime,itemid) VALUES ('" . md5($saveto) . "','{$saveto}','{$do->file_size}','{$do->ext}','{$from}','{$img_w}','{$img_h}','{$moduleid}','{$_username}','{$DT_IP}','{$do->uptime}','{$itemid}')");
}
if ($MG['uploadcredit'] > 0) {
require DT_ROOT . '/include/module.func.php';
credit_add($_username, -$MG['uploadcredit']);
credit_record($_username, -$MG['uploadcredit'], 'system', $L['upload'], $from);
}
if ($swfupload) {
exit('FILEID:' . $saveto);
}
$pr = 'parent.document.getElementById';
if ($from == 'thumb') {
$js .= 'try{' . $pr . '("d' . $fid . '").src="' . $saveto . '";}catch(e){}';
$js .= $pr . '("' . $fid . '").value="' . $saveto . '";';
$js .= 'window.parent.cDialog();';
} else {
if ($from == 'album' || $from == 'photo') {
$js .= 'window.parent.getAlbum("' . $saveto . '", "' . $fid . '");';
$js .= $from == 'photo' ? $pr . '("dform").submit();' : 'window.parent.cDialog();';
} else {
示例9: foreach
$continue = FALSE;
$uids = $_POST['uids'];
if (is_array($uids)) {
foreach ($uids as $uid) {
if ($user_config['status'] == 3) {
$parent_uid = user_getparentbyuid($uid);
if ($parent_uid == $user_config['uid']) {
$continue = TRUE;
}
}
if (auth_isadmin()) {
$continue = TRUE;
}
$amount = -1 * abs($_POST['amount']);
if ($continue && $amount < 0 && ($username = user_uid2username($uid))) {
if (credit_add($uid, $amount)) {
$current_balance = credit_getbalance($uid);
$_SESSION['dialog']['info'][] .= _('Credit has been reduced') . ' (' . _('user') . ':' . $username . ' ' . _('amount') . ':' . $amount . ' ' . _('balance') . ':' . $current_balance . ')';
} else {
$_SESSION['dialog']['info'][] .= _('Fail to reduce credit') . ' (' . _('user') . ':' . $username . ' ' . _('amount') . ':' . $amount . ')';
}
} else {
$_SESSION['dialog']['info'][] .= _('Wrong amount or user does not exist') . ' (' . _('User ID') . ':' . $uid . ')';
}
}
}
header("Location: " . _u('index.php?app=main&inc=feature_credit&op=credit_reduce'));
exit;
break;
}
break;
示例10: login
function login($login_username, $login_password, $login_cookietime = 0, $admin = false)
{
global $DT_TIME, $DT_IP, $MOD, $MODULE, $L;
if (!check_name($login_username)) {
return $this->_($L['member_login_username_bad']);
}
if (!$MOD || !isset($MOD['login_times'])) {
$MOD = cache_read('module-2.php');
}
$login_lock = $MOD['login_times'] && $MOD['lock_hour'] ? true : false;
$LOCK = array();
if ($login_lock) {
$LOCK = cache_read($DT_IP . '.php', 'ban');
if ($LOCK) {
if ($DT_TIME - $LOCK['time'] < $MOD['lock_hour'] * 3600) {
if ($LOCK['times'] >= $MOD['login_times']) {
return $this->_(lang($L['member_login_ban'], array($MOD['login_times'], $MOD['login_hour'])));
}
} else {
$LOCK = array();
cache_delete($DT_IP . '.php', 'ban');
}
}
}
$user = userinfo($login_username, 0);
if (!$user) {
$this->lock($login_lock, $LOCK, $DT_IP, $DT_TIME);
return $this->_($L['member_login_not_member']);
}
if (!$admin) {
if ($user['password'] != (is_md5($login_password) ? md5($login_password) : md5(md5($login_password)))) {
$this->lock($login_lock, $LOCK, $DT_IP, $DT_TIME);
return $this->_($L['member_login_password_bad']);
}
}
if ($user['groupid'] == 2) {
return $this->_($L['member_login_member_ban']);
}
$userid = $user['userid'];
if (isset($MODULE[16])) {
$cart = get_cookie('cart');
if ($cart) {
$this->cart($cart, $userid, $DT_TIME);
}
}
if ($MOD['credit_login'] > 0 && timetodate($DT_TIME, 3) != timetodate($user['logintime'], 3)) {
credit_add($login_username, $MOD['credit_login']);
credit_record($login_username, $MOD['credit_login'], 'system', $L['member_record_login'], $DT_IP);
}
$cookietime = $DT_TIME + ($login_cookietime ? intval($login_cookietime) : 86400 * 7);
$auth = encrypt($user['userid'] . "\t" . $user['username'] . "\t" . $user['groupid'] . "\t" . $user['password'] . "\t" . $user['admin']);
set_cookie('auth', $auth, $cookietime);
set_cookie('userid', $user['userid'], $cookietime);
set_cookie('username', $user['username'], $DT_TIME + 86400 * 365);
$this->db->query("UPDATE {$this->table_member} SET loginip='{$DT_IP}',logintime={$DT_TIME},logintimes=logintimes+1 WHERE userid={$userid}");
return $user;
}
示例11: intval
if ($item['process'] == 2) {
$a = $db->get_one("SELECT * FROM {$table}_answer WHERE qid={$itemid} ORDER BY vote DESC");
if ($a && $a['vote'] > $MOD['minvote']) {
$aid = intval($a['itemid']);
$expert = $a['expert'] ? $a['username'] : '';
if ($expert) {
$db->query("UPDATE {$table}_expert SET best=best+1 WHERE username='{$expert}'");
}
$db->query("UPDATE {$table} SET process=3,aid={$aid},expert='{$expert}',updatetime='{$DT_TIME}' WHERE itemid={$itemid}");
if ($a['username']) {
if ($item['credit']) {
credit_add($a['username'], $item['credit']);
credit_record($a['username'], $item['credit'], 'system', lang($L['record_reward'], array($MODULE[$moduleid]['name'])), 'ID:' . $itemid);
}
if ($MOD['credit_best']) {
credit_add($a['username'], $MOD['credit_best']);
credit_record($a['username'], $MOD['credit_best'], 'system', lang($L['record_best'], array($MODULE[$moduleid]['name'])), 'ID:' . $itemid);
}
}
} else {
$db->query("UPDATE {$table} SET process=0,updatetime='{$DT_TIME}' WHERE itemid={$itemid}");
}
$reload = true;
}
}
if ($reload) {
if ($MOD['show_html']) {
tohtml('show', $module);
}
dalert('', '', 'top.window.location.reload();');
}
示例12: VALUES
}
}
$db->query("UPDATE {$DT_PRE}comment SET quote=quote+1 WHERE itemid={$qid}");
}
$db->query("INSERT INTO {$DT_PRE}comment (item_mid,item_id,item_title,item_username,content,quotation,qid,addtime,username,hidden,star,ip,status) VALUES ('{$mid}','{$itemid}','{$title}','{$username}','{$content}','{$quotation}','{$qid}','{$DT_TIME}','{$_username}','{$hidden}','{$star}','{$DT_IP}','{$status}')");
$cid = $db->insert_id();
$r = $db->get_one("SELECT sid FROM {$DT_PRE}comment_stat WHERE moduleid={$mid} AND itemid={$itemid}");
$star = 'star' . $star;
if ($r) {
$db->query("UPDATE {$DT_PRE}comment_stat SET comment=comment+1,`{$star}`=`{$star}`+1 WHERE sid={$r['sid']}");
} else {
$db->query("INSERT INTO {$DT_PRE}comment_stat (moduleid,itemid,{$star},comment) VALUES ('{$mid}','{$itemid}','1','1')");
}
if ($status == 3) {
if ($_username && $MOD['credit_add_comment']) {
credit_add($_username, $MOD['credit_add_comment']);
credit_record($_username, $MOD['credit_add_comment'], 'system', $L['comment_record_add'], 'ID:' . $cid);
}
$items = isset($items) ? intval($items) + 1 : 1;
$page = ceil($items / $pagesize);
$forward = rewrite('index.php?mid=' . $mid . '&itemid=' . $itemid . '&page=' . $page . '&rand=' . mt_rand(10, 99)) . '#last';
dalert('', '', 'parent.window.location="' . $forward . '";');
} else {
dalert($L['comment_check'], '', 'parent.window.location=parent.window.location;');
}
} else {
$lists = array();
$pages = '';
$r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}comment WHERE item_mid={$mid} AND item_id={$itemid} AND status=3");
$items = $r['num'];
$pages = pages($items, $page, $pagesize);
示例13: money_add
}
if ($fee_add) {
if ($fee_currency == 'money') {
money_add($_username, -$fee_add);
money_record($_username, -$fee_add, $L['in_site'], 'system', lang($L['credit_record_add'], array($MOD['name'])), 'ID:' . $do->itemid);
} else {
credit_add($_username, -$fee_add);
credit_record($_username, -$fee_add, 'system', lang($L['credit_record_add'], array($MOD['name'])), 'ID:' . $do->itemid);
}
}
if ($post['credit']) {
credit_add($_username, -$post['credit']);
credit_record($_username, -$post['credit'], 'system', lang($L['credit_record_reward'], array($MOD['name'])), 'ID:' . $do->itemid);
}
if (isset($post['hidden']) && $MOD['credit_hidden']) {
credit_add($_username, -$MOD['credit_hidden']);
credit_record($_username, -$MOD['credit_hidden'], 'system', lang($L['credit_record_hidden'], array($MOD['name'])), 'ID:' . $do->itemid);
}
if ($post['ask'] && check_name($post['ask'])) {
$db->query("UPDATE {$table}_expert SET ask=ask+1 WHERE username='{$post['ask']}'");
$touser = $post['ask'];
$title = lang($L['know_new_title'], array($post['title']));
$question = $post['title'];
$itemid = $do->itemid;
$content = ob_template('ask', 'mail');
send_message($touser, $title, $content);
}
$js = '';
if (isset($post['sync_sina']) && $post['sync_sina']) {
$js .= sync_weibo('sina', $moduleid, $do->itemid);
}
示例14: delete
function delete($itemid, $all = true)
{
global $MOD, $L;
if (is_array($itemid)) {
foreach ($itemid as $v) {
$this->delete($v);
}
} else {
$this->itemid = $itemid;
$r = $this->get_one();
$userid = get_user($r['username']);
if ($r['thumb']) {
delete_upload($r['thumb'], $userid);
}
$this->db->query("DELETE FROM {$this->table} WHERE itemid={$itemid}");
if ($r['username'] && $MOD['credit_del_credit']) {
credit_add($r['username'], -$MOD['credit_del_credit']);
credit_record($r['username'], -$MOD['credit_del_credit'], 'system', $L['honor_punish_reason'], 'ID:' . $this->itemid);
}
}
}
示例15: get_status
$need_check = $MOD['check_answer'] == 2 ? $MG['check'] : $MOD['check_answer'];
$status = get_status(3, $need_check);
$db->query("INSERT INTO {$table}_answer (qid,content,username,addtime,ip,status) VALUES ('{$itemid}', '{$content}', '{$_username}', '{$DT_TIME}', '{$DT_IP}', '{$status}')");
if ($status == 3) {
$db->query("UPDATE {$table} SET answer=answer+1 WHERE itemid={$itemid}");
}
if ($MOD['credit_answer'] && $_username && $status == 3) {
$could_credit = true;
if ($MOD['credit_maxanswer'] > 0) {
$r = $db->get_one("SELECT SUM(amount) AS total FROM {$DT_PRE}finance_credit WHERE username='{$_username}' AND addtime>{$DT_TIME}-86400 AND reason='" . $L['answer'] . "'");
if ($r['total'] > $MOD['credit_maxanswer']) {
$could_credit = false;
}
}
if ($could_credit) {
credit_add($_username, $MOD['credit_answer']);
credit_record($_username, $MOD['credit_answer'], 'system', $L['answer'], 'ID:' . $itemid . '(' . $L['know_by_mobile'] . ')');
}
}
if ($MOD['answer_message'] && $item['username']) {
$linkurl = $MOD['linkurl'] . $item['linkurl'];
$message = lang($L['answer_message'], array(dsubstr($item['title'], 20, '...'), $item['title'], nl2br($content), $linkurl));
send_message($item['username'], dsubstr($message, 60, '...'), $message);
}
exit($status == 3 ? 'ok' : 'check');
}
$head_title = $L['know_title'] . $DT['seo_delimiter'] . $head_title;
$foot = '';
include template('know_answer', 'mobile');
if (DT_CHARSET != 'UTF-8') {
toutf8();