$userid = @$db->result_first("select userid from {$tpf}users where username='******'"); if (!$userid) { echo '<script>alert("' . __('username') . '[' . $word . ']' . __('not_found') . ');</script>'; } else { $sql_ext = $sql_ext ? $sql_ext . " and uo.userid='{$userid}' " : ''; } } $perpage = 50; $sql_do = "{$tpf}income_orders uo,{$tpf}users u where u.userid=uo.userid {$sql_ext}"; $rs = $db->fetch_one_array("select count(*) as total_num from {$sql_do}"); $total_num = $rs['total_num']; $start_num = ($pg - 1) * $perpage; $q = $db->query("select uo.*,u.username,u.userid from {$sql_do} order by order_id desc limit {$start_num},{$perpage}"); $logs = array(); while ($rs = $db->fetch_array($q)) { $rs['status_txt'] = $rs['o_status'] == 'success' || $rs['o_status'] == 'fail' ? get_income_status($rs['o_status']) : ''; $rs['a_view'] = urr(ADMINCP, "item=users&menu=user&action=user_edit&uid={$rs['userid']}"); $rs['in_time'] = date("Y-m-d H:i:s", $rs['in_time']); $logs[] = $rs; } $db->free($q); unset($rs); $page_nav = multi($total_num, $perpage, $pg, urr(ADMINCP, "item={$item}&menu=user&action={$action}")); require_once template_echo($item, $admin_tpl_dir, '', 1); } break; case 'credit_log': if ($task == 'update') { form_auth(gpc('formhash', 'P', ''), formhash()); $setting = array('show_credit_log' => 0, 'close_credit_log' => 0); $settings = gpc('setting', 'P', $setting);
$curr_credit_rate = $myinfo[credit_rate] ? exp_credit_rate($myinfo[credit_rate]) : ($settings[how_downs_credit] && $settings[how_money_credit] ? $settings[how_downs_credit] . '==¥' . $settings[how_money_credit] : ''); $freeze_money = @$db->result_first("select sum(money) from {$tpf}income_orders where userid='{$pd_uid}' and o_status='pendding'"); $freeze_money = $freeze_money ? '<span class="txtgray">(' . __('incoming') . ':¥' . $freeze_money . ')</span>' : ''; $my_downlines = @$db->result_first("select count(*) from {$tpf}buddys where userid='{$pd_uid}'"); require_once template_echo('profile', $user_tpl_dir); } break; case 'income_log': $sql_do = " {$tpf}income_orders io,{$tpf}users u where io.userid=u.userid and io.userid='{$pd_uid}'"; $rs = $db->fetch_one_array("select count(*) as total_num from {$sql_do}"); $total_num = $rs['total_num']; $start_num = ($pg - 1) * $perpage; $q = $db->query("select * from {$sql_do} order by order_id desc limit {$start_num},{$perpage}"); $orders = array(); while ($rs = $db->fetch_array($q)) { $rs['o_status'] = get_income_status($rs['o_status']); $rs['in_time'] = date('Y-m-d H:i:s', $rs['in_time']); $orders[] = $rs; } $db->free($q); unset($rs); $page_nav = multi($total_num, $perpage, $pg, urr("mydisk", "item=profile&action=income_log")); require_once template_echo('profile', $user_tpl_dir); break; case 'credit_log': if ($auth[view_credit]) { $sql_do = "(p.action='download' or p.action='view')"; } else { $sql_do = "p.action='download'"; } $sql_do = get_table_credit_log() . " p,{$tpf}files f where {$sql_do} and p.userid='{$pd_uid}' and p.file_id=f.file_id";