init(); //if(!$_G['uid'])showmessage('对不起,您还没有登陆,请先注册登陆然后再试听!!','member.php?mod=logging&action=login'); require_once 'deltime.php'; $aid = intval($_G['gp_aid']); //echo $aid; //@include DISCUZ_ROOT.'./forumdata/cache/cache_settings.php'; //$attachdir=$_DCACHE['settings'][attachdir]; $timestamp=time(); if($timestamp-$deltime>1800)deletetmpfile(); $query = DB::query("SELECT * FROM ".DB::table('forum_attachment')." WHERE aid='$aid'"); $attach = DB::fetch($query); $tableid = $attach[tableid]; //echo $tableid;exit(); $attach = DB::fetch_first("SELECT * FROM ".DB::table('forum_attachment_'.$tableid)." WHERE aid='$aid'"); $dianxin=$attach[dianxin]; //echo $attach[uid];exit(); $dianxin = 0; $atn = $attach[filename]; $attach[filename]=$timestamp.rand(0,50).'.'.fileext($attach[filename]); $sourcefile=$_G['setting']['attachdir'].'/forum/'.$attach['attachment']; $sourcefile1='D:/xyzdown/data/attachment'.'/forum/'.$attach['attachment']; if(!is_readable($sourcefile))$sourcefile = $sourcefile1; $destfile=getcwd()."/temp/".$attach[filename]; $destfile1=getcwd()."/temp/".'1_'.$attach[filename]; // echo $sourcefile; $turl='http://61.235.170.179/attachment_ex.php?aid='.$aid; $turl1='http://117.25.129.176:88/attachment_ex.php?aid='.$aid; // if (trim(@file_get_contents($turl1))==1){ if($dianxin==1){ $url="http://222.84.227.71/x2_lss_remote.php?aid=$aid";//echo $url; $contents = trim(@file_get_contents($url)); //echo $contents; $url='http://222.84.227.71/temp/'.$contents; //$url='ftp://down:down@61.235.170.179/'.$contents; $url1='http://222.84.227.71/temp/1_'.$contents; //$url1='ftp://down:down@61.235.170.179/1_'.$contents; include template('forum/lsremote_dianxin'); /* }else if (trim(@file_get_contents($turl))==1){ $url="http://61.235.170.179/lss_remote.php?aid=$aid";//echo $url; $contents = trim(@file_get_contents($url)); //echo $contents; $url='http://61.235.170.179:88/temp/'.$contents; //$url='ftp://down:down@61.235.170.179/'.$contents; $url1='http://61.235.170.179:88/temp/1_'.$contents; //$url1='ftp://down:down@61.235.170.179/1_'.$contents; include template('lsremote'); */ }else{ //if(is_readable($sourcefile)){ @unlink($destfile); //$fclist=array(319,344,329,71,345,295,244,385,384,383,381,251,255,370,399,371,369,355,394,295); //if(in_array($attach[fid],$fclist)) $blv=1;else $blv=0.25; //echo $sourcefile; $handler=@fopen($sourcefile,'r'); $handlew=@fopen($destfile,'w'); $handlew1=@fopen($destfile1,'w'); //$csize=round($attach[filesize]*$blv);//echo $csize; $csize=round($attach[filesize]/4); @fwrite($handlew,fread($handler,$csize),$csize); fread($handler,$csize);fread($handler,$csize); //fread($handler,$csize); @fwrite($handlew1,fread($handler,$csize),$csize); @fclose($handler);@fclose($handlew1);@fclose($handlew); //$attach[filename]=urlencode($attach[filename]); //header('Location: ftp://down:xianlai@222.170.66.102/'.$attach[filename]); //header('Location: ftp://down:xianlai@218.246.177.205/'.$attach[filename]); //header('Location: http://58.59.176.36/temp/'.$attach[filename]); /* if($_G[groupid]==140 || $_G[groupid]==150){ $url='http://hk.xianlaiju.com/temp/'.$attach[filename]; $url1='http://hk.xianlaiju.com/temp/'.'1_'.$attach[filename]; }else{ $url='http://hk.xianlaiju.com/temp/'.$attach[filename]; $url1='http://hk.xianlaiju.com/temp/'.'1_'.$attach[filename]; } */ $url='http://t2.xianlaiju.com/temp/'.$attach[filename]; $url1='http://t2.xianlaiju.com/temp/'.'1_'.$attach[filename]; $navtitle = '伴奏音乐试听'; $fext = fileext(strtolower($attach['filename'])); include template('forum/ls'); } /////////删除临时文件///////////// function deletetmpfile(){ global $timestamp; static $result_array=array(); $handle = opendir(getcwd().'/temp/'); while ($file = readdir($handle)) { if($file=='.'||$file=='..'||$file=='index.htm') continue; $result_array[]=$file; } closedir($handle); foreach($result_array AS $file){ $filename=getcwd().'/temp/'.$file; $fmtime=filemtime($filename);//echo $fmtime.'-'.$timestamp; if($timestamp-$fmtime>1800)@unlink($filename); //@unlink($file); } $cachedata="$"."deltime=".$timestamp; @$fp = fopen("deltime.php", 'w'); @fwrite($fp, ""); @fclose($fp); } /* /////////删除临时文件///////////// function fileext($filename) { return trim(substr(strrchr($filename, '.'), 1, 10)); } */ ?>