Beispiel #1
0
        case 'd_now_week':
            $d_val = date('YW');
            break;
        case 'd_week':
            $d_val = date('YW', strtotime('-1 week'));
            break;
        case 'd_month':
            $d_val = date('Ym');
            break;
    }
    if ($o_type == 'd_3day') {
        $sql_do = " {$tpf}files fl," . get_table_day_down() . " dd,{$tpf}users u where fl.file_id=dd.file_id and fl.userid=u.userid {$cate_sql} and dd.d_day in ({$d_str}) and fl.is_del=0";
    } elseif ($o_type == 'd_now_week') {
        $sql_do = " {$tpf}files fl," . get_table_day_down() . " dd,{$tpf}users u where fl.file_id=dd.file_id and fl.userid=u.userid {$cate_sql} and dd.d_week='{$d_val}' and fl.is_del=0";
    } else {
        $sql_do = " {$tpf}files fl," . get_table_day_down() . " dd,{$tpf}users u where fl.file_id=dd.file_id and fl.userid=u.userid {$cate_sql} and dd.{$o_type}='{$d_val}' and fl.is_del=0";
    }
}
$rs = $db->fetch_one_array("select count(*) as total_num from {$sql_do}");
$total_num = $rs['total_num'];
$start_num = ($pg - 1) * $perpage;
if ($o_type == 'd_all') {
    $q = $db->query("select fl.*,u.username from {$sql_do} group by file_id order by fl.file_downs desc,file_id desc limit {$start_num},{$perpage}");
} else {
    $q = $db->query("select fl.*,u.username from {$sql_do} group by file_id order by fl.file_downs desc,fl.file_id desc limit {$start_num},{$perpage}");
}
$files_array = array();
while ($rs = $db->fetch_array($q)) {
    $tmp_ext = $rs['file_extension'] ? '.' . $rs['file_extension'] : "";
    $rs['file_thumb'] = get_file_thumb($rs);
    $rs['file_name_all'] = filter_word($rs['file_name'] . $tmp_ext);
Beispiel #2
0
    case 'guest':
        if ($task == 'guest') {
            auth_task_guest();
        } else {
            $ref = $_SERVER['HTTP_REFERER'];
            $can_edit = (int) $myinfo[can_edit];
            require_once template_echo('profile', $user_tpl_dir);
        }
        break;
    case 'multi_upload':
        if ($settings['open_multi_server']) {
            $rs = $db->fetch_one_array("select server_host,server_key from {$tpf}servers where server_id>1 order by is_default desc limit 1");
            if ($rs) {
                $upload_url = $rs['server_host'] . 'mydisk.php?item=upload&code=' . pd_encode($rs['server_key']);
            }
            unset($rs);
        }
        require_once template_echo('profile', $user_tpl_dir);
        break;
    default:
        $today_credit = (int) @$db->result_first("select sum(down_count) from " . get_table_day_down() . " where userid='{$pd_uid}' and d_day='" . date('Ymd') . "'");
        $yesterday_credit = (int) @$db->result_first("select sum(down_count) from " . get_table_day_down() . " where userid='{$pd_uid}' and d_day='" . date('Ymd', strtotime('-1 day')) . "'");
        $vip_end_time = get_profile($pd_uid, 'vip_end_time');
        if ($vip_end_time > $timestamp) {
            $vip_end_time_txt = date('Y-m-d', get_profile($pd_uid, 'vip_end_time'));
        } else {
            $vip_end_time_txt = date('Y-m-d', get_profile($pd_uid, 'vip_end_time')) . ', <span class="txtred">(' . __('vip_end_time_expire') . ')</span>';
        }
        $downline_num = (int) @$db->result_first("select count(*) from {$tpf}buddys where is_system=1 and userid='{$pd_uid}'");
        require_once template_echo('profile', $user_tpl_dir);
}
Beispiel #3
0
function cal_downs($file_id)
{
    global $db, $tpf, $timestamp, $onlineip, $my_sid, $auth, $settings;
    $down_file = gpc('down_file_log', 'C', 0);
    $rs = $db->fetch_one_array("select userid,file_size from {$tpf}files where file_id='{$file_id}'");
    if ($rs) {
        $userid = $rs[userid];
        $file_size = $rs[file_size];
    }
    unset($rs);
    $ip_interval = get_plans(get_profile($userid, 'plan_id'), 'ip_interval');
    $ip_interval = $ip_interval ? (int) $ip_interval : 24;
    $db->query_unbuffered("update {$tpf}files set file_last_view='{$timestamp}' where file_id='{$file_id}'");
    if (!$down_file && check_download_ok($my_sid, $ip_interval * 60)) {
        //if(1){
        pd_setcookie('down_file_log', 1, $ip_interval * 60);
        $id = (int) @$db->result_first("select id from " . get_table_day_down() . " where file_id='{$file_id}' and d_day='" . date('Ymd') . "'");
        if (!$id) {
            $ins = array('d_year' => date('Y'), 'd_month' => date('Ym'), 'd_day' => date('Ymd'), 'd_week' => date('YW'), 'file_id' => $file_id, 'down_count' => 1, 'userid' => $userid);
            $db->query_unbuffered("insert into " . get_table_day_down() . " set " . $db->sql_array($ins) . "");
            if ($auth[open_plan_active] && $settings[open_plan_active]) {
                $dday = date('Ymd', strtotime('-1 day'));
                $dweek = date('YW', strtotime('-1 week'));
                if ($settings[down_active_interval] == 'week') {
                    $sql_do = " and d_week='{$dweek}'";
                } else {
                    $sql_do = " and d_day='{$dday}'";
                }
                $mydowns = (int) @$db->result_first("select sum(down_count) from " . get_table_day_down() . " where userid='{$userid}' {$sql_do}");
                //echo $mydowns.',';
                $mydowns = $mydowns ? get_discount($userid, $mydowns) : 1;
                $to_plan_id = @$db->result_first("select plan_id from {$tpf}plans where {$mydowns}>=down_active_num_min and {$mydowns}<down_active_num_max and is_hidden=0");
                //echo $to_plan_id;
                if ($to_plan_id && date('Ymd', get_profile($userid, 'plan_conv_time')) != date('Ymd')) {
                    conv_credit($userid);
                    $ins = array('open_plan' => 1, 'plan_id' => $to_plan_id, 'credit_rate' => get_plans($to_plan_id, 'income_rate'), 'plan_conv_time' => $timestamp);
                    $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$userid}'");
                }
            }
        } else {
            $db->query_unbuffered("update " . get_table_day_down() . " set down_count=down_count+1 where id='{$id}'");
        }
        $add_credit = 1;
        if ($settings[promo_time] != '') {
            $hour = date('G');
            $arr = explode(',', $settings[promo_time]);
            if (in_array($hour, $arr)) {
                $add_credit = 2;
            }
        }
        add_credit_log($file_id, $add_credit, 'download', $userid);
        $db->query_unbuffered("update {$tpf}users set credit=credit+{$add_credit} where userid='{$userid}'");
        $db->query_unbuffered("update {$tpf}files set file_downs=file_downs+1 where file_id='{$file_id}'");
        $db->query_unbuffered("update {$tpf}users set dl_credit=dl_credit+1 where userid=(select userid from {$tpf}buddys where touserid='{$userid}')");
        $upline_userid = (int) @$db->result_first("select userid from {$tpf}buddys where touserid='{$userid}'");
        $db->query_unbuffered("update {$tpf}users set dl_credit2=dl_credit2+1 where userid=(select userid from {$tpf}buddys where touserid='{$upline_userid}')");
    }
    echo 'true';
}
Beispiel #4
0
function get_day_down_file($stat_time, $stat_type = 'd_day', $cate_id = 0, $uid = 0, $num = 10)
{
    global $db, $tpf;
    $sql_uid = $uid ? " and dd.userid='{$uid}'" : '';
    $q = $db->query("select fl.file_id,file_name,file_extension,file_time,file_size from {$tpf}files fl," . get_table_day_down() . " dd where dd.{$stat_type}='{$stat_time}' and fl.file_id=dd.file_id and in_share=1 and cate_id='{$cate_id}' and is_del=0 {$sql_uid} order by dd.down_count desc limit {$num}");
    $file = array();
    while ($rs = $db->fetch_array($q)) {
        $tmp_ext = $rs['file_extension'] ? '.' . $rs['file_extension'] : "";
        $rs['file_name'] = filter_word($rs['file_name'] . $tmp_ext);
        $rs['a_viewfile'] = urr("viewfile", "file_id={$rs['file_id']}");
        $rs['file_time'] = is_today($rs['file_time']) ? '<span class="txtred" style="float:right">' . date('m/d', $rs['file_time']) . '</span>' : '<span class="txtgray" style="float:right">' . date('m/d', $rs['file_time']) . '</span>';
        $rs['file_icon'] = file_icon($rs['file_extension']);
        $rs[file_size] = '<span class="txtgray" style="float:right">' . get_size($rs[file_size]) . '</span>';
        $file[] = $rs;
    }
    $db->free($q);
    unset($rs);
    return $file;
}