Example #1
0
 if ($r['status'] == 0) {
     $charge_orderid = $r['itemid'];
     $charge_money = $r['amount'] + $r['fee'];
     $charge_amount = $r['amount'];
     $editor = 'N' . $bank;
     if ($total_fee == $charge_money) {
         $db->query("UPDATE {$DT_PRE}finance_charge SET status=3,money={$charge_money},receivetime='{$DT_TIME}',editor='{$editor}' WHERE itemid={$charge_orderid}");
         require DT_ROOT . '/include/module.func.php';
         money_add($r['username'], $r['amount']);
         money_record($r['username'], $r['amount'], $PAY[$bank]['name'], 'system', '在线充值', '订单ID:' . $charge_orderid);
         $MOD = cache_read('module-2.php');
         if ($MOD['credit_charge'] > 0) {
             $credit = intval($r['amount'] * $MOD['credit_charge']);
             if ($credit > 0) {
                 credit_add($r['username'], $credit);
                 credit_record($r['username'], $credit, 'system', '充值奖励', '充值' . $r['amount'] . $DT['money_unit']);
             }
         }
         exit('success');
     } else {
         $note = '充值金额不匹配S:' . $charge_money . 'R:' . $total_fee;
         $db->query("UPDATE {$DT_PRE}finance_charge SET status=1,receivetime='{$DT_TIME}',editor='{$editor}',note='{$note}' WHERE itemid={$charge_orderid}");
         //支付失败
         #log_result($note);
         exit('fail');
     }
 } else {
     if ($r['status'] == 1) {
         exit('fail');
     } else {
         if ($r['status'] == 2) {
Example #2
0
 function check($itemid, $status = 3)
 {
     global $_username, $DT_TIME, $MOD;
     if (is_array($itemid)) {
         foreach ($itemid as $v) {
             $this->check($v, $status);
         }
     } else {
         $this->itemid = $itemid;
         $item = $this->get_one();
         if ($MOD['credit_reply'] && $status == 3) {
             if ($item['username'] && $item['addtime'] >= $item['edittime']) {
                 credit_add($item['username'], $MOD['credit_reply']);
                 credit_record($item['username'], $MOD['credit_reply'], 'system', lang('my->credit_record_reply_add'), 'ID:' . $itemid);
             }
         }
         $this->db->query("UPDATE {$this->table} SET status={$status},editor='{$_username}',edittime={$DT_TIME} WHERE itemid={$itemid}");
         $this->tohtml($item['tid']);
     }
 }
Example #3
0
     $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='******' 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();
 }
Example #4
0
            $year = floor($months / 12);
            if ($months % 12 == 0) {
                $to_month = 12;
                $to_year = $next_year + $year - 1;
            } else {
                $to_month = $months % 12;
                $to_year = $next_year + $year;
            }
            $totime = strtotime($to_year . '-' . $to_month . '-1');
            $status = $EXT['spread_check'] ? 2 : 3;
            if ($currency == 'money') {
                money_add($_username, -$amount);
                money_record($_username, -$amount, $L['in_site'], 'system', $MODULE[$mid]['name'] . $L['spread_title'], $word . '(' . $L['spread_infoid'] . $buy_tid . ')');
            } else {
                credit_add($_username, -$amount);
                credit_record($_username, -$amount, 'system', $MODULE[$mid]['name'] . $L['spread_title'], $word . '(ID:' . $buy_tid . ')');
            }
            $db->query("INSERT INTO {$DT_PRE}spread (mid,tid,word,price,currency,company,username,addtime,fromtime,totime,status) VALUES ('{$mid}','{$buy_tid}','{$word}','{$buy_price}','{$currency}','{$_company}','{$_username}','{$DT_TIME}','{$next_time}','{$totime}','{$status}')");
            dmsg($L['spread_msg_success'], '?status=' . $status);
        } else {
            //
        }
    } else {
        dheader($EXT['spread_url']);
    }
} else {
    $status = isset($status) ? intval($status) : 3;
    in_array($status, array(2, 3)) or $status = 3;
    $condition = "username='******' AND status={$status}";
    $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}spread WHERE {$condition}");
    $pages = pages($r['num'], $page, $pagesize);
Example #5
0
     in_array($month, $months) or message($L['style_msg_month']);
     $amount = $r['fee'] * $month;
     if ($currency == 'money') {
         if ($amount > $_money) {
             message($L['money_not_enough'], $MODULE[2]['linkurl'] . 'charge.php?action=pay&amount=' . ($amount - $_money));
         }
         is_payword($_username, $password) or message($L['error_payword']);
         money_add($_username, -$amount);
         money_record($_username, -$amount, $L['in_site'], 'system', $L['pay_in_site'], lang($L['style_record_buy'], array($r['title'], $month)));
         $fd = 'money';
     } else {
         if ($amount > $_credit) {
             message($L['credit_not_enough'], $MODULE[2]['linkurl'] . 'credit.php?action=buy&amount=' . ($amount - $_credit));
         }
         credit_add($_username, -$amount);
         credit_record($_username, -$amount, 'system', lang($L['style_record_buy'], array($r['title'], $month)));
         $fd = 'credit';
     }
     $styletime = $DT_TIME + 86400 * 30 * $month;
     $c = $db->get_one("SELECT skin FROM {$DT_PRE}company WHERE userid={$_userid}");
     $c['skin'] or $c['skin'] = 'default';
     $o = $db->get_one("SELECT itemid FROM {$DT_PRE}style WHERE skin='{$c['skin']}'");
     if ($o) {
         $db->query("UPDATE {$DT_PRE}style SET hits=hits-1 WHERE itemid={$o['itemid']} AND hits>1");
     }
     $db->query("UPDATE {$DT_PRE}style SET hits=hits+1,`{$fd}`=`{$fd}`+{$amount} WHERE itemid={$itemid}");
     $db->query("UPDATE {$DT_PRE}company SET template='{$r['template']}',skin='{$r['skin']}',styletime={$styletime} WHERE userid={$_userid}");
     dmsg($L['style_msg_buy_success'], '?action=index');
 } else {
     $r['thumb'] = is_file(DT_ROOT . '/' . $MODULE[4]['moduledir'] . '/skin/' . $r['skin'] . '/thumb.gif') ? $MODULE[4]['linkurl'] . 'skin/' . $r['skin'] . '/thumb.gif' : $MODULE[4]['linkurl'] . 'image/nothumb.gif';
     extract($r);
Example #6
0
 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;
     }
 }
Example #7
0
 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;
 }
Example #8
0
        }
        if ($could_credit) {
            $r = $db->get_one("SELECT itemid FROM {$DT_PRE}finance_credit WHERE note='{$DT_IP}' AND addtime>{$DT_TIME}-86400");
            if ($r) {
                $could_credit = false;
            }
        }
        if ($could_credit && $MOD['credit_maxip'] > 0) {
            $r = $db->get_one("SELECT SUM(amount) AS total FROM {$DT_PRE}finance_credit WHERE username='******' AND addtime>{$DT_TIME}-86400 AND reason='{$reason}'");
            if ($r['total'] > $MOD['credit_maxip']) {
                $could_credit = false;
            }
        }
        if ($could_credit) {
            credit_add($username, $MOD['credit_ip']);
            credit_record($username, $MOD['credit_ip'], 'system', $reason, $DT_IP);
            set_cookie('inviter', encrypt($username, DT_KEY . 'INVITER'), $DT_TIME + 30 * 86400);
        }
    } else {
        dheader(DT_PATH);
    }
} else {
    dheader(DT_PATH);
}
$goto = isset($goto) ? trim($goto) : '';
$URI = DT_PATH;
if ($goto == 'register') {
    $URI = $MODULE[2]['linkurl'] . $DT['file_register'];
} else {
    if ($goto == 'homepage') {
        if ($userurl) {
Example #9
0
 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='******'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);
 }
 if (isset($post['sync_qq']) && $post['sync_qq']) {
Example #10
0
         }
         $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);
     $result = $db->query("SELECT * FROM {$DT_PRE}comment WHERE item_mid={$mid} AND item_id={$itemid} AND status=3 ORDER BY itemid ASC LIMIT {$offset},{$pagesize}");
Example #11
0
 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);
         }
     }
 }
Example #12
0
     $sms = intval($sms);
     $usernames = explode("\n", trim($vip['username']));
     foreach ($usernames as $username) {
         $username = trim($username);
         if (!$username) {
             continue;
         }
         $vip['username'] = $username;
         $do->vip_edit($vip);
         if ($money) {
             money_add($username, $money);
             money_record($username, $money, '站内', $_username, $reason, $GROUP[$vip['groupid']]['groupname']);
         }
         if ($credit) {
             credit_add($username, $credit);
             credit_record($username, $credit, $_username, $reason, $GROUP[$vip['groupid']]['groupname']);
         }
         if ($sms) {
             sms_add($username, $sms);
             sms_record($username, $sms, $_username, $reason, $GROUP[$vip['groupid']]['groupname']);
         }
     }
     dmsg('添加成功', $this_forward);
 } else {
     isset($username) or $username = '';
     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";
Example #13
0
    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) . "')");
    money_add($_username, -$fee);
Example #14
0
     break;
 case 'getcreditsettings':
     API_GETCREDITSETTINGS or exit(API_RETURN_FORBIDDEN);
     $credits = array(1 => array('积分', '分'));
     echo uc_serialize($credits);
     break;
 case 'updatecredit':
     $credit = intval($uc_arr['amount']);
     if ($credit) {
         $type = $uc_arr['credit'];
         $uid = $uc_arr['uid'];
         $user = uc_get_user($uid, 1);
         $username = $user[1];
         if ($username) {
             credit_add($username, $credit);
             credit_record($username, $credit, 'system', 'UC Credits', 'extcredits' . $type);
             exit('1');
         } else {
             exit('0');
         }
     } else {
         exit('0');
     }
     break;
 case 'updatecreditsettings':
     exit('1');
     break;
 case 'updateapps':
     exit('1');
     break;
 default:
Example #15
0
            $post = daddslashes($post);
            $sql = '';
            foreach ($post as $k => $v) {
                $sql .= ",{$k}='{$v}'";
            }
            $db->query("INSERT INTO {$DT_PRE}weixin_chat SET " . substr($sql, 1));
        }
        if ($credit_add && $WX['credit']) {
            //签到送积分
            $credit = intval($WX['credit']);
            $user = weixin_user($FromUserName);
            if ($user['credittime'] < 1) {
                $user['credittime'] = 1;
            }
            $msg = '欢迎回来,今日已签到,请继续使用其他服务';
            if ($credit && $user && $user['username'] && timetodate($DT_TIME, 3) != timetodate($user['credittime'], 3)) {
                require_once DT_ROOT . '/include/module.func.php';
                credit_add($user['username'], $credit);
                credit_record($user['username'], $credit, 'system', '微信签到');
                $db->query("UPDATE {$DT_PRE}weixin_user SET credittime={$DT_TIME} WHERE itemid={$user['itemid']}");
                $msg = '签到成功,已赠送您' . $credit . $DT['credit_name'];
            }
            $wx->response($FromUserName, $ToUserName, 'text', $msg);
        }
        $db->query("UPDATE {$DT_PRE}weixin_user SET visittime={$DT_TIME} WHERE openid='{$FromUserName}'");
    } else {
        echo $_GET["echostr"];
    }
} else {
    echo DT_DEBUG ? 'Working...' : '<meta http-equiv="refresh" content="0;url=../">';
}
Example #16
0
 function check($itemid, $status = 3)
 {
     global $MOD;
     if (is_array($itemid)) {
         foreach ($itemid as $v) {
             $this->check($v, $status);
         }
     } else {
         if ($MOD['credit_answer'] && $status == 3) {
             $this->itemid = $itemid;
             $item = $this->get_one();
             if ($item['username']) {
                 credit_add($item['username'], $MOD['credit_answer']);
                 credit_record($item['username'], $MOD['credit_answer'], 'system', lang('my->credit_record_answer_add'), 'ID:' . $itemid);
             }
         }
         $this->db->query("UPDATE {$this->table} SET status={$status} WHERE itemid={$itemid}");
     }
 }
Example #17
0
        is_payword($_username, $password) or mobile_msg($L['not_payword']);
        $discount = $MG['discount'] > 0 && $MG['discount'] < 100 ? $MG['discount'] : 100;
        $discount = dround($discount / 100);
        $_fee = dround($fee * $discount);
        $_money >= $_fee or mobile_msg($L['need_charge']);
        $db->query("INSERT INTO {$DT_PRE}finance_pay (moduleid,itemid,username,fee,currency,paytime,ip,title) VALUES ('{$moduleid}','{$itemid}','{$_username}','{$fee}','{$currency}','{$DT_TIME}','{$DT_IP}','" . addslashes($title) . "')");
        money_add($_username, -$fee);
        money_record($_username, -$fee, $L['pay_by_site'], 'system', $L['pay_info'], $note);
        mobile_msg($L['pay_success'], mobileurl($moduleid, 0, $itemid));
    } else {
        $head_title = $L['pay_title'] . $DT['seo_delimiter'] . $head_title;
        $foot = 'channel';
        include template('pay', 'mobile');
        if (DT_CHARSET != 'UTF-8') {
            toutf8();
        }
    }
} else {
    if ($currency == 'credit') {
        if ($_credit >= $fee) {
            $db->query("INSERT INTO {$DT_PRE}finance_pay (moduleid,itemid,username,fee,currency,paytime,ip,title) VALUES ('{$moduleid}','{$itemid}','{$_username}','{$fee}','{$currency}','{$DT_TIME}','{$DT_IP}','" . addslashes($title) . "')");
            credit_add($_username, -$fee);
            credit_record($_username, -$fee, 'system', $L['pay_info'], $note);
            dheader(mobileurl($moduleid, 0, $itemid));
        } else {
            mobile_msg($L['need_credit']);
        }
    } else {
        dheader('channel.php?reload=' . $DT_TIME);
    }
}
Example #18
0
            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='******'");
            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'];
    extract($user);
Example #19
0
             $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='******'");
                 }
                 $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();');
     }
 }
Example #20
0
             $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;
     $process = isset($process) ? intval($process) : '-1';
Example #21
0
         }
     }
 }
 $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 {
         if ($from == 'editor') {
Example #22
0
         if (!$username) {
             continue;
         }
         $r = $db->get_one("SELECT username,credit FROM {$DT_PRE}member WHERE 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";
             }
         }
     }
Example #23
0
     $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");
     }
     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='******' 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 . '(WAP)');
         }
     }
     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);
     }
     wap_msg($status == 3 ? $L['answer_success'] : $L['answer_check'], "?moduleid={$moduleid}&itemid={$itemid}");
 } else {
     if ($TP == 'touch') {
         $head_link = 'index.php?moduleid=' . $moduleid . '&amp;itemid=' . $itemid . '&amp;action=list';
         $head_name = $L['answer_list'];
         $back_link = 'javascript:Dback(\'' . $head_link . '\');';
         $pages = '';
     }
Example #24
0
 $charge_amount = $r['amount'];
 if ($r['status'] == 0) {
     $receive_url = '';
     $bank = $r['bank'];
     $editor = 'R' . $bank;
     $note = '';
     include DT_ROOT . '/api/pay/' . $bank . '/receive.inc.php';
     if ($charge_status == 1) {
         $db->query("UPDATE {$DT_PRE}finance_charge SET status=3,money={$charge_money},receivetime='{$DT_TIME}',editor='{$editor}' WHERE itemid={$charge_orderid}");
         money_add($r['username'], $r['amount']);
         money_record($r['username'], $r['amount'], $PAY[$bank]['name'], 'system', $L['charge_online'], $L['charge_id'] . ':' . $charge_orderid);
         if ($MOD['credit_charge'] > 0) {
             $credit = intval($r['amount'] * $MOD['credit_charge']);
             if ($credit > 0) {
                 credit_add($r['username'], $credit);
                 credit_record($r['username'], $credit, 'system', $L['charge_reward'], $L['charge'] . $r['amount'] . $DT['money_unit']);
             }
         }
         if ($r['reason']) {
             $url = get_reason_url($r['reason']);
             if ($url) {
                 $charge_forward = $url;
             }
         }
         if ($bank == 'tenpay') {
             $show_url = $charge_forward ? $charge_forward : 'charge.php';
             if (strpos($show_url, '://') === false) {
                 $show_url = $MOD['linkurl'] . $show_url;
             }
             $resHandler->doShow($show_url);
         }
Example #25
0
 case 'buy':
     if ($MOD['credit_buy'] && $MOD['credit_price']) {
         $C = explode('|', trim($MOD['credit_buy']));
         $P = explode('|', trim($MOD['credit_price']));
         if ($submit) {
             is_payword($_username, $password) or message($L['error_payword']);
             array_key_exists($type, $C) or message($L['credit_msg_buy_amount']);
             $amount = $P[$type];
             $credit = $C[$type];
             if ($amount > 0) {
                 $_money >= $amount or message($L['money_not_enough'], 'charge.php?action=pay&reason=credit&amount=' . ($amount - $_money));
                 money_add($_username, -$amount);
                 money_record($_username, -$amount, $L['in_site'], 'system', $L['buy'] . $DT['credit_name'], $credit . $DT['credit_unit']);
                 if ($credit > 0) {
                     credit_add($_username, $credit);
                     credit_record($_username, $credit, 'system', $L['buy'] . $DT['credit_name'], $amount . $DT['money_unit']);
                 }
             }
             dmsg($L['credit_msg_buy_success'], $forward ? $forward : '?action=index');
         } else {
             $select = isset($C[$sum]) ? $sum : 0;
         }
     } else {
         message($L['feature_close'], '?action=index');
     }
     $head_title = $L['credit_buy_title'];
     break;
 case 'invite':
     $head_title = $L['invite_title'];
     $url = $MOD['linkurl'] . 'invite.php?user=' . $_username;
     break;
Example #26
0
 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);
         }
     }
 }
Example #27
0
         $ad['typeid'] = $typeid;
         $ad['amount'] = $amount;
         $ad['currency'] = $currency;
         $ad['title'] = $post['fromtime'] . '(' . $_username . ')';
         $ad['introduce'] = timetodate($DT_TIME, 5) . ' ' . $L['ad_buy_paid'] . $amount . $unit;
         $ad['note'] = $post['note'] . ' - ' . $L['ad_buy_note'] . '(' . $DT_IP . ')';
         $ad['status'] = 2;
         $ad['username'] = $_username;
         $ad = dhtmlspecialchars($ad);
         if ($amount) {
             if ($currency == 'money') {
                 money_add($_username, -$amount);
                 money_record($_username, -$amount, $L['in_site'], 'system', $L['pay_in_site'], $p['name'] . $L['ad_buy_title'] . $month . $L['month']);
             } else {
                 credit_add($_username, -$amount);
                 credit_record($_username, -$amount, 'system', $p['name'] . $L['ad_buy_title'], $month . $L['month']);
             }
         }
         $sqlk = $sqlv = '';
         foreach ($ad as $k => $v) {
             $sqlk .= ',' . $k;
             $sqlv .= ",'{$v}'";
         }
         $sqlk = substr($sqlk, 1);
         $sqlv = substr($sqlv, 1);
         $db->query("INSERT INTO {$DT_PRE}ad ({$sqlk}) VALUES ({$sqlv})");
         $db->query("UPDATE {$DT_PRE}ad_place SET ads=ads+1 WHERE pid={$pid}");
         message($L['ad_buy_success'], '?status=2');
     }
 } else {
     dheader($adurl);
Example #28
0
 if ($FD) {
     fields_update($post_fields, $table, $do->itemid);
 }
 if ($CP) {
     property_update($post_ppt, $moduleid, $post['catid'], $do->itemid);
 }
 if ($MOD['show_html'] && $post['status'] > 2) {
     $do->tohtml($do->itemid);
 }
 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);
     }
 }
 $msg = $post['status'] == 2 ? $L['success_check'] : $L['success_add'];
 $js = '';
 if (isset($post['sync_sina']) && $post['sync_sina']) {
     $js .= sync_weibo('sina', $moduleid, $do->itemid);
 }
 if (isset($post['sync_qq']) && $post['sync_qq']) {
     $js .= sync_weibo('qq', $moduleid, $do->itemid);
 }
 if (isset($post['sync_qzone']) && $post['sync_qzone']) {
     $js .= sync_weibo('qzone', $moduleid, $do->itemid);
 }
 if ($_userid) {
     set_cookie('dmsg', $msg);
Example #29
0
     }
     if ($process == 4) {
         dalert($L['gift_error_4'], $linkurl);
     }
     if ($_credit < $credit) {
         dalert($L['gift_error_5'], $linkurl);
     }
     if (!check_group($_groupid, $groupid)) {
         dalert($L['gift_error_6'], $linkurl);
     }
     $t = $db->get_one("SELECT * FROM {$DT_PRE}gift_order WHERE itemid={$itemid} AND username='******'");
     if ($t) {
         dalert($L['gift_error_7'], rewrite('index.php?action=my'));
     }
     credit_add($_username, -$credit);
     credit_record($_username, -$credit, 'system', $L['gift_credit_reason'], 'ID:' . $itemid);
     $db->query("INSERT INTO {$DT_PRE}gift_order (itemid,credit,username,ip,addtime,status) VALUES ('{$itemid}','{$credit}','{$_username}','{$DT_IP}','{$DT_TIME}','" . $L['gift_status'] . "')");
     $db->query("UPDATE {$DT_PRE}gift SET orders=orders+1 WHERE itemid={$itemid}");
     dheader(rewrite('index.php?success=1&itemid=' . $itemid));
     break;
 default:
     if ($itemid) {
         $do->itemid = $itemid;
         $item = $do->get_one();
         $item or dheader($MOD['gift_url']);
         extract($item);
         $left = $amount - $orders > 0 ? $amount - $orders : 0;
         $process = $left ? get_process($fromtime, $totime) : 4;
         $adddate = timetodate($addtime, 3);
         $fromdate = $fromtime ? timetodate($fromtime, 3) : $L['timeless'];
         $todate = $totime ? timetodate($totime, 3) : $L['timeless'];