<?
//论坛数据库信息
$dbuser='dbuser'; //数据库用户名
$dbpass='dbpass'; //数据库密码
$dbname='dbname'; //数据库名
$shownum='10'; //显示数量
$titlelen=35; //第一个版块的标题长度
$titlelen2=35; //第二个版块的标题长度
$titlelen3=35; //第三个版块的标题长度
$lasttime=time()-51840000; //显示两个月内的热门贴
mysql_connect('',$dbuser,$dbpass); //连接数据库
mysql_query("SET NAMES GBK");
mysql_select_db($dbname);
//-------------------美女写真-------------------
$select = mysql_query("SELECT tid,fid,author,lastpost,dateline,lastposter,views,subject,replies FROM cdb_threads where fid=27 and lastpost>$lasttime and closed=0 ORDER BY replies DESC LIMIT 0, $shownum"); //查询表
$result=mysql_fetch_array($select); //以下show是输出
$show.= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
while ($result)
{
$longname=$result['subject'];
//截取帖子标题长度
if(strlen($result['subject']) > $titlelen)
{
$result['subject']=substr($result['subject'],"0",$titlelen-4).chr(0);
$result['subject']=$result['subject']."...";
}
$lastpost=date('Y-m-d',$result[lastpost]);
$dateline=date('Y-m-d',$result[dateline]);
$show.="<tr><td>";
$show.="<a href=http://bbs.1001year.net/thread-{$result[tid]}-1-1.html target=_blank title='标题:{$longname}
作者:{$result['author']}
发表日期:{$dateline}
最后回复:{$lastpost}({$result['lastposter']})
阅读次数:{$result['views']}
回复次数:{$result['replies']}'>".$result['subject']."</a>";
$show.="</td></tr>";
$result=mysql_fetch_array($select);
}
$show.="</table>";
$filename='bbs_mv.html';
$handle=fopen ($filename,"w");
fwrite($handle,$show);
fclose($handle);
unset ($show);
//-------------------精彩贴图-------------------
$select = mysql_query("SELECT tid,fid,author,lastpost,dateline,lastposter,views,subject,replies FROM cdb_threads where fid=20 and lastpost>$lasttime and closed=0 ORDER BY replies DESC LIMIT 0, $shownum");
$result=mysql_fetch_array($select);
$show.= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
while ($result)
{
$longname=$result['subject'];
//截取帖子标题长度
if(strlen($result['subject']) > $titlelen2)
{
$result['subject']=substr($result['subject'],"0",$titlelen2-4).chr(0);
$result['subject']=$result['subject']."...";
}
$lastpost=date('Y-m-d',$result[lastpost]);
$dateline=date('Y-m-d',$result[dateline]);
$show.="<tr><td>";
$show.="<a href=http://bbs.1001year.net/thread-{$result[tid]}-1-1.html target=_blank title='标题:{$longname}
作者:{$result['author']}
发表日期:{$dateline}
最后回复:{$lastpost}({$result['lastposter']})
阅读次数:{$result['views']}
回复次数:{$result['replies']}'>".$result['subject']."</a>";
$show.="</td></tr>";
$result=mysql_fetch_array($select);
}
$show.="</table>";
$filename='bbs_tt.html';
$handle=fopen ($filename,"w");
fwrite($handle,$show);
fclose($handle);
unset ($show);
//-------------------占星奇缘-------------------
$select = mysql_query("SELECT tid,fid,author,lastpost,dateline,lastposter,views,subject,replies FROM cdb_threads where fid=78 and lastpost>$lasttime and closed=0 ORDER BY replies DESC LIMIT 0, $shownum");
$result=mysql_fetch_array($select);
$show.= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\r\n";
while ($result)
{
$longname=$result['subject'];
//截取帖子标题长度
if(strlen($result['subject']) > $titlelen2)
{
$result['subject']=substr($result['subject'],"0",$titlelen3-4).chr(0);
$result['subject']=$result['subject']."...";
}
$lastpost=date('Y-m-d',$result[lastpost]);
$dateline=date('Y-m-d',$result[dateline]);
$show.="<tr><td>";
$show.="<a href=http://bbs.1001year.net/thread-{$result[tid]}-1-1.html target=_blank title='标题:{$longname}
作者:{$result['author']}
发表日期:{$dateline}
最后回复:{$lastpost}({$result['lastposter']})
阅读次数:{$result['views']}
回复次数:{$result['replies']}'>".$result['subject']."</a>";
$show.="</td></tr>";
$result=mysql_fetch_array($select);
}
$show.="</table>";
$filename='bbs.html';
$handle=fopen ($filename,"w");
fwrite($handle,$show);
fclose($handle);
unset ($show);
?>
能解释的就这些了,实在找不到可以再解释的东西。 |