说明一下:
这是把这张贴子
http://www.phpwind.net/read-htm-tid-514799-fpage-2.html 的改一下.因为.很多人找不到第一步,
演示地址:
http://www.8kai.cn/read.php?tid-1350.html图片:
1.require\pw_func.php
找到:
$ifupload=3;$type='zip';
在下面添加:$ifupload=4;$type='torrent';6.0正式版就是改了上面这一步..其它都没变
2.thread.php
找到:
$attachtype=array(
'1'=>'img',
'2'=>'txt',
'3'=>'zip'
);
修改为:
$attachtype=array(
'1'=>'img',
'2'=>'txt',
'3'=>'zip',
'4'=>'torrent'
);
3.require\updateforum.php
找到:
switch($type){
case 'img': return 1;
case 'txt': return 2;
case 'zip': return 3;
}
修改为:
switch($type){
case 'img': return 1;
case 'txt': return 2;
case 'zip': return 3;
case 'torrent': return 4;
}
4.read.php
找到:
else{
$read['downattach'][$at['aid']]=array($at['aid'],$at['name'],$at['size'],$at['hits'],$at['needrvrc']
上面加上:
else if($at['type']=='torrent'){
require_once (R_P.'require/BDecode.php');
require_once (R_P.'require/BEncode.php');
//打开bt文件,并获取其中的
信息!
$fd = fopen(R_P.$attachpath.'/'.$at['attachurl'],"rb");
$btsize = $at['size']*1024;
$alltorrent = fread($fd,$btsize);
$array = BDecode($alltorrent);
if ($array) {
$at['hash'] = @sha1(BEncode($array["info"]));
$at['announce']=$array['announce'];
if (sizeof($array['info']['files'])<=1) {
$at['btfilesize']=$array['info']['length'];
$at['btfilename']=$array['info']['name'];
}else{
$at['btfilesize']=0;
$at['btfilename']=$array['info']['files']['name'];
for ( $i=0 ; $i<sizeof($array['info']['files']);$i++){
for ($j=0;$j<sizeof($array['info']['files'][$i]['path']);$j++){
$at['btfilename'].="/".$array['info']['files'][$i]['path'][$j];
}
$at['btfilename'].='
';
$at['btfilesize']+=$array['info']['files'][$i]['length'];
}
}
$at['btfilename']=str_replace(array('>', '<', '"'),array('', '', "
& q u o t" ),$at['btfilename']);
$at['btfilename']= nl2br($at['btfilename']);
if ($at['btfilesize']<1024 ) {
$at['btfilesize']=$at['btfilesize']."B";
}
elseif ($at['btfilesize']<(1024*1024)) {
$at['btfilesize']=(integer)($at['btfilesize']/1024) ;
$at['btfilesize']=$at['btfilesize']."KB";
}
elseif ($at['btfilesize']<(1024*1024*1024)) {
$at['btfilesize']=(integer)($at['btfilesize']/(1024*1024));
$at['btfilesize']=$at['btfilesize']."MB";
}elseif ($at['btfilesize']<(1024*1024*1024*1024)) {
$at['btfilesize']=(integer)($at['btfilesize']/(1024*1024*1024));
$at['btfilesize']=$at['btfilesize']."GB";
}
else{
$at['btfilesize']=(integer)($at['btfilesize']/(1024*1024*1024*1024));
$at['btfilesize']=$at['btfilesize']."TB";
}
unset($array);
fclose($fd);
}
$read['torrent'][]=array($at['aid'],$at['name'],$at['size'],$at['hits'],$at['needrvrc'],$at['type'],$dfadmin,
$at['hash'],$at['btfilesize'],$at['btfilename'],$at['announce']);
}
找到:
$read['downattach'][$at['aid']]=array($at['aid'],$at['name'],$at['size'],$at['hits'],$at['needrvrc'],$at['type'],$dfadmin,$at['desc']);
修改为:
$read['downattach'][$at['aid']]=array($at['aid'],$at['name'],$at['size'],$at['hits'],$at['needrvrc'],$at['type'],$dfadmin,$at['desc'],$at['hash'],$at['btfilesize'],$at['btfilename'],$at['announce']);
5.read.htm:
找到:
<div class="tpc_content" id="read_$read[pid]">$read[content]</div>
下面添加:
<!--
EOT;
if($read['torrent']){
foreach($read['torrent'] as $bt){
if($bt){print <<<EOT
-->
<table align="center" width="80%" border="0" cellspacing="1" cellpadding="3" bgcolor=$tablecolor style="table-layout: fixed; word-wrap: break-word">
<tr class="head"><td colspan="3" align="center">BitTorrent 下載 </td></tr>
<tr class=t_one><td colspan="3" align="center"><img src='$imgpath/$stylepath/file/$bt[5].gif' align=absbottom> 種子下載:
<a href='job.php?action=download&pid=$read[pid]&tid=$tid&aid=$bt[0]' target='_blank'><font color=red>$bt[1]</font></a>($bt[2]K)(下載次數$bt[3])
<!--
EOT;
if($bt[4]){print <<<EOT
-->
需要威望:$bt[4]
<!--
EOT;
}if($bt[6]){print <<<EOT
-->
[<a href='job.php?action=deldownfile&pid=$read[pid]&tid=$tid&aid=$bt[0]'><font color=red>刪除</font></a>]
<!--
EOT;
}print <<<EOT
-->
</td></tr>
<tr class=t_one><td width="100">文件hash :</td><td width="320" colspan="2">$bt[7]</td></tr>
<tr class=t_two><td>文件大小 :</td><td colspan="2">$bt[8]</td></tr>
<tr class=t_one><td>文件/目錄名 :</td><td colspan="2">$bt[9]</td></tr>
<tr class=t_two><td>Tracker: </td><td colspan="2">$bt[10]</td></tr>
</table>
<!--
EOT;
}}}print <<<EOT
-->
6.把文件BDecode.php和BEncode.php放到论坛require目录里
红色为必须修改此处,一定要把& q u o t写上,并且字符间不带空格 才能在READ页显示 否则白页 很多人都这样的BT文件分析插件.rar