|
本帖最后由 潇声 于 2011-11-19 02:48 编辑
根目录ajax.php
case 'down_process':
$temp_ip = base64_decode(gpc('down_ip','C',''));
$file_id = (int)gpc('file_id','G',0);
$userid = $db->result_first("select userid from {$tpf}files where file_id='$file_id'");
$exp_down = (int)$settings['exp_down'];
$db->query_unbuffered("update {$tpf}users set exp=exp+$exp_down where userid='$pd_uid'");
$exp_down_my = (int)$settings['exp_down_my'];
$db->query_unbuffered("update {$tpf}users set exp=exp+$exp_down_my where userid='$userid'");
if($temp_ip!=get_ip()){
if($settings['credit_open'] && $pd_uid!=$userid){//这里的$pd_uid,如果是游客的话,下面$pd_credit会出现错误
$credit = $settings['credit_open'] ? (int)$settings['credit_down'] : 0;
$credit_my = $settings['credit_open'] ? (int)$settings['credit_down_my'] : 0;
$pd_credit = (int)$db->result_first("select credit from {$tpf}users where userid='$pd_uid' limit 1");
if($pd_credit && $pd_credit>=$credit){
$db->query_unbuffered("update {$tpf}users set credit=credit-{$credit} where userid='$pd_uid'");
}
$db->query_unbuffered("update {$tpf}users set credit=credit+{$credit_my} where userid='$userid'");
unset($rs);
}
pd_setcookie('down_ip',base64_encode(get_ip()),86400);
$db->query_unbuffered("update {$tpf}files set file_downs=file_downs+1,file_last_view='$timestamp' where file_id='$file_id'");
}
if(display_plugin('filelog','open_filelog_plugin',($settings['open_filelog'] && $settings['open_down_filelog']),0)){
$username = @$db->result_first("select username from {$tpf}users where userid='$userid' limit 1");
$down_username = @$db->result_first("select username from {$tpf}users where userid='$pd_uid' limit 1");
$down_username = $down_username ? $down_username : '-';
$log_format = $file_name.'|'.get_size($file_size).'|'.$L['download'].'|'.$username.'|'.$down_username.'|'.date("Y-m-d H:i:s").'|'.$onlineip;
all_file_logs($log_format);
my_file_down_logs($log_format,$userid);
}
echo 'true';
break; |
|