<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("inc/pageclass.php");//调用分页类文件
include_once("conn.php");
include_once("inc/ftcode.php");
include_once("checkuser.php");

if ($_GET["exit"]=="yes"){
 set_cookie('clubuser_id', $value = "", time-3600);
 set_cookie('username', $value = "", time-3600);
 set_cookie('clubuser_password', $value = "", time-3600);
 set_cookie('bbsuser', $value = "", time-3600);
 set_cookie('bz', $value = "", time-3600);
 set_cookie('bbsadmin', $value = "", time-3600);
 set_cookie('payuser', $value = "", time-3600);

 unset($_SESSION['id']); 
 header("Location:default.php");
}
$layer_1 = ftbbs_request($_GET["layer_1"]);
$layer_2 = ftbbs_request($_GET["layer_2"]);

$ftbbs_name=get_cookie('username');
$ftbbs_bz=get_cookie('bz');
$ftbbs_bbsadmin=get_cookie('bbsadmin');
$ftbbs_payuser=get_cookie('payuser');

$page = intval($_GET["page"]);
$qs=intval($_GET["qs"]);
$jh=intval($_GET["huati"]);
$tj=intval($_GET["sign"]);
$flag=intval($_GET["flag"]);
$order_key=$_GET["order_key"];//排序方式
if($order_key==""){
  if ($layer_1==""){
  $order_key="bbstop1 desc,redate";
  }
  else{
  $order_key="bbstop1 desc,bbstop desc,redate";
  }
}
if ($layer_1==""){
	$BBS_Cate_Manager_Name=""; //'默认总版主
}

$searchcontent=$_GET["searchcontent"];//搜索内容
$searchkind=$_GET["searchkind"];//搜索类别

if ($jh==1){
   $jhtj="and huati=".$jh;
   $jhortj=" and huati=".$jh;
}
if ($tj==1){
   $jhtj="and sign=".$tj;
   $jhortj=" and sign=".$tj;
}
if ($flag==1 || $flag==2){
   $jhtj="and flag=".$flag;
   $jhortj=" and flag=".$flag;
}

if ($searchkind==""){
	$search_str=" ";
	}
elseif ($searchkind=="name"){
	$search_str=" and name= '".$searchcontent."' ";
}

$strqs="";
$qssqlstr1="";

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
include_once("sound.php");
$bbsname=$ftbbsmb[11];
$copyright=$ftbbsmb[14];
$getcodeoff=$ftbbsmb[30];
$onlineoff=$ftbbsmb[33];
$linkoff=$ftbbsmb[34];
$htmlsign=$ftbbsmb[37];
$defaulthome=$ftbbsmb[31];
include_once("ftbbs_nav.php");
include_once("homeurl.php");

if ($layer_1!=""){	
$str_BBS_Cate="select * from {$tablepre}bbs_cate where BBS_Cate_ID='".$layer_1."' and deleted=0";
$rscate=mysql_query($str_BBS_Cate);
$bbscaterow = mysql_fetch_array($rscate);
$BBS_Cate_Name_1=$bbscaterow[3];
$BBS_Cate_Manager_Name="版主：".$bbscaterow[6];
mysql_free_result($rscate);
}

if ($layer_2!=""){
$str_BBS_Cate="select * from {$tablepre}bbs_cate where BBS_Cate_ID='".$layer_2."' and deleted=0";
$rscate=mysql_query($str_BBS_Cate);
$bbscaterow = mysql_fetch_array($rscate);
$BBS_Cate_Board=$bbscaterow["15"];
$BBS_Cate_Name_2=$bbscaterow[3];
$BBS_Cate_Manager_Name="版主：".$bbscaterow[6];
mysql_free_result($rscate);
}

if ($qs=="" || $qs==4 || $qs==5){
   $qs=0;
}
if ($qs!=0){
    if (($qs==1 || $qs==2 || $qs==3) && $ftbbs_name==""){
	  header("Location:userlogin.php");
	  exit;
	  }
	elseif ($ftbbs_payuser==0 && $ftbbs_bz==0 && $qs==2){
      login_msg(1,"userlogin.php");
	  exit;
	  }
	elseif ($ftbbs_bz==0 && $ftbbs_bbsadmin==0 && $qs==3){
      login_msg(2,"userlogin.php");
	  exit;	
	}
}

//以下是论坛权限访问功能设置
if ($ftbbs_name==""){
   $strqssql="where BBS_Cate_Qs=1 or BBS_Cate_Qs=2 or BBS_Cate_Qs=3";
   }
else{
   if ($ftbbs_payuser==1){
      $strqssql="where BBS_Cate_Qs=3";
	  }
   elseif ($ftbbs_bz==1 || $ftbbs_bbsadmin==1){
      $strqssql="";
	  }
   else{
      $strqssql="where BBS_Cate_Qs=2 or BBS_Cate_Qs=3";
   }
}

//$qssql="select * from bbs_cate where BBS_ID in(select MIN(BBS_ID) from bbs_cate ".$strqssql." group by BBS_Cate_ID) order by BBS_ID asc";
$qssql="select BBS_Cate_ID from {$tablepre}bbs_cate ".$strqssql."";
$qsrs=mysql_query($qssql);
$qsrow = mysql_fetch_array($qsrs);
$numrows = mysql_num_rows($qsrs);//

if ($numrows!=0 && $strqssql!=""){
//if ($numrows>=1){
    $k=0;
    do {
	  $k++;
      if ($k==$numrows){
	     $qsbbsx1=$qsrow[1];
	  }
	  else{
         $qsbbsx1=$qsrow[1].",";
	  }
	  $qsbbs1=$qsbbs1.$qsbbsx1;
     }
	while ($qsrow = mysql_fetch_array($qsrs));
   //echo strrpos($qsbbs1,",");
   if (strrpos($qsbbs1,",")){
     $qsarray1 = explode(",",$qsbbs1);
	 for($b=0; $b<count($qsarray1); $b++){
        if ($b==count($qsarray1)-1){
	    $qssqlstrx = "BoardID_1<>'" . $qsarray1[$b] ."' and BoardID_2<>'" . $qsarray1[$b] ."'";
		}
	    else{
	    $qssqlstrx = "BoardID_1<>'" . $qsarray1[$b] ."' and BoardID_2<>'" . $qsarray1[$b] ."' and ";
	    }
	    $qssqlstr1 = $qssqlstr1.$qssqlstrx;
     }
     $qssqlstr1 = $qssqlstr1." and ";
	 }
   else{
     $qssqlstr1 = "BoardID_1<>'" .$qsbbs1."' and BoardID_2<>'".$qsbbs1."' and ";
   }
   $strqs=$qssqlstr1;
}

$p = new ft_page;
if ($layer_1==""){
	$strsql="select ID,BoardID_1,BoardID_2,user_id,name,title,hit,rep,dateh,redate,bbs_img,bbs_img_display,huati,img_url_display,P_display,picture,sign,zhiye,htmfilename,bbstop,bbstop1,flag,titlecolor,boardsign,reinfo,bbs_img_display,bbs_img from {$tablepre}bbstitle where ".$strqs." deleted=0 ".$search_str." ".$jhortj." order by ".$order_key." desc";
}
else{
	if ($layer_2==""){
	   $strsql="select ID,BoardID_1,BoardID_2,user_id,name,title,hit,rep,dateh,redate,bbs_img,bbs_img_display,huati,img_url_display,P_display,picture,sign,zhiye,htmfilename,bbstop,bbstop1,flag,titlecolor,boardsign,reinfo,bbs_img_display,bbs_img from {$tablepre}bbstitle where ".$strqs." deleted=0 and (BoardID_1='".$layer_1."' or bbstop1=1)".$search_str." ".$jhortj." order by ".$order_key." desc";
	}
	else{
	   $strsql="select ID,BoardID_1,BoardID_2,user_id,name,title,hit,rep,dateh,redate,bbs_img,bbs_img_display,huati,img_url_display,P_display,picture,sign,zhiye,htmfilename,bbstop,bbstop1,flag,titlecolor,boardsign,reinfo,bbs_img_display,bbs_img from {$tablepre}bbstitle where ".$strqs." deleted=0 and ((BoardID_1='".$layer_1."' and BoardID_2='".$layer_2."') or bbstop1=1) ".$jhortj." order by ".$order_key." desc";
	}
}
$pagesize=$ftbbsmb[5];
$rs=mysql_query($strsql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
//$numrows=$myrow[0];
$p->pvar="page"; 
$p->setvar(array("layer_1" => $layer_1, "layer_2" => $layer_2,"huati" =>$jh,"sign" =>$tj,"searchkind"=>$searchkind,"searchcontent"=>$searchcontent ));
$p->set($pagesize,$numrows,$psize); 
$rs=mysql_query($strsql." limit ".$p->limit());
?>
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=utf-8>
<title><?=$ftbbsmb[11]?></title>
<? if ($num>0 && $ftbbs_name!=""){?>
<script src="smsad.js"></script>
<? }?>
<script language=javascript src="inc/cookies.js"></script>
<script>
var stylecook = getCookie("STYLESHOW");
var style;
var strstyle;
if(stylecook=="")
{
 stylecook=1;
}
else
{
 stylecook++;
}
style="main0"+stylecook+".css";
strstyle="<link href=\"css/"+style+"\"  rel=\"stylesheet\" type=\"text/css\"> ";
document.write(strstyle);
</script>
</HEAD>
<SCRIPT LANGUAGE="VBScript"> 
<!--
Sub order_key_OnChange
	if document.jump.order_key.value <> "" then
		document.jump.action = "main.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&order_key="&document.jump.order_key.value&"&searchkind=<?=$searchkind?>&searchcontent=<?=$searchcontent?>"
		jump.submit
	end if
End Sub
-->
</SCRIPT>

<script>
function changeCssStyle()
{
	var sCssType = document.all.select3.value;
	setCookie("STYLESHOW", sCssType);
	//window.navigate("default.php");
    window.location.href='main.php';
    parent.left.document.location.reload();
}
</script>
</head>
<body>
<script>
var stylecook = getCookie("STYLESHOW");
var style;
var tmpstylecook;
function setcookies()
{
 tmpstylecook = stylecook;
}

function  reloadcook()
{
   var scooks = getCookie("STYLESHOW");
   if(scooks != tmpstylecook)
   {
 	window.location.reload();
   }
}
setcookies();
setInterval('reloadcook()',1000);
</script>
<?
if (get_cookie('ftbbstype')==1){
include_once("pbhead.php");
}
?>
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td> 
      <table width="100%" border=0 cellpadding=2 cellspacing=1 class="maintbbg">
        <tbody>
          <tr> 
            <td height="25" class="f12bg">&nbsp;<?=$userinfo?></td>
          </tr>
          <tr>
            <td height="26" class="maintbtr3"><table width="100%" border=0 cellpadding=0 cellspacing=0>
                <tbody>
                  <tr> 
                    <td width="60%" class=f12><img src="images/bbs_t1.gif" align="absmiddle"> 
                      <?if ($layer_1!=""&&$layer_2!=""){?>
                        <a href="<?=$homepage?>">论坛首页</a>>><a href="main.php?layer_1=<?=$layer_1?>&qs=<?=$qs?>"><?=$BBS_Cate_Name_1?></a> 
                         <?}
						 if ($layer_2!=""){
						 echo ">>".$BBS_Cate_Name_2;
                         }
					  elseif($layer_1!=""&&$layer_2==""){
                         echo "<a href=".$homepage.">论坛首页</a> >>".$BBS_Cate_Name_1;
                         }
					  elseif($layer_1==""&&$layer_2==""){
                         echo "<a href=".$homepage.">论坛首页</a>";
                         }
					    if ($BBS_Cate_Name_1==""){
					     $stats="论坛首页";
						 }
					    else{
					      if ($BBS_Cate_Name_2==""){
					      $stats=$BBS_Cate_Name_1;
						  }
						  else{
						  $stats=$BBS_Cate_Name_2;
						  }
						}
					  ?>
					</td>
                    <td width="27%" class=f12><div align="right"><?=str_replace("|",",",$BBS_Cate_Manager_Name)?></div></td>
                    <td width="13%" class=f12>
					  <div align="right"><a href="bz.php">版主工作评定</a></div></td>
                  </tr>
                </tbody>
              </table></td>
          </tr>
        </tbody>
      </table>
<script src="listad.js"></script>
<?
if ($BBS_Cate_Board!=""){
?>	  
<table width="100%" border="0" align="center" cellpadding="0">
  <tr> 
    <td height=2><spacer height="2" type="block"></td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="maintbbg">
  <tr> 
    <td class="maintbtr3"><table width="100%" border="0" cellspacing="3" cellpadding="3">
        <tr> 
         <td class="maintbtr2"><font color="#FF3333">版 规 和 导 读:</font></td>
        </tr>
		<tr> 
           <td class="maintbtr3" style=" LINE-HEIGHT: 160%"><?=ubb($BBS_Cate_Board)?></td>
        </tr>
      </table></td>
  </tr>
</table>
<?
}
?>
      <table cellspacing=0 cellpadding=0 width="100%" border=0>
        <tbody> 
        <tr> 
            <td width="30%" height="35"><a href="fbht.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&fd=0"><img src="images/btn_post.gif" width="61" height="21" border="0" align="absmiddle"></a>&nbsp;<a href="fbht.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&fd=1"><img src="images/btn_poll.gif" width="61" height="21" border="0" align="absmiddle"></a>&nbsp;<a href="fbht.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&fd=2"><img src="images/fd_add.gif" width="61" height="21" border="0" align="absmiddle"></a></td>
          <FORM METHOD=POST ACTION="main.php" onSubmit="return check_search(this)">
              <td width="52%" align=right valign="middle"> 
                <div align="right"> 
                  <div class="f12">
                    <?if (get_cookie('ftbbstype')==1){?>
                    <a href="default.php?a=<?=$layer_1?>&b=<?=$layer_2?>&qs=<?=$qs?>&ft=0" target="_top">框架结构浏览</a> 
                    <?}else{?>
                    <a href="default.php?a=<?=$layer_1?>&b=<?=$layer_2?>&qs=<?=$qs?>&ft=1" target="_top">平板结构浏览</a> 
                    <?}?>
        风格选择:<select name=select3  style="background-color:#ffffff;FONT-FAMILY: Arial; FONT-SIZE: 9pt; FONT-STYLE: normal; WIDTH: 85px" size=1 onChange="javascript:changeCssStyle();">
        <option  value="1" selected style="color:#799AE1">■标准风格</option>
        <option value="0" style="color:66ABD9">■浅蓝风格</option>
        <option value="2" style="color:#FA71C0">■女性风格</option>
        <option value="3" style="color:#D56BDE">■紫色风格</option>
        <option value="4" style="color:#EC8205">■黄色风格</option>
		<option value="5" style="color:#529E20">■绿色风格</option>
      </select>
	  </div></div></td>
          </form>
          <form name="jump" method="post" action="">     
            <td width="18%" valign="middle" class="f12"> 
              <div align="right">排序方式:<select name="order_key" style="background-color:#ffffff;FONT-FAMILY: Arial; FONT-SIZE: 9pt; FONT-STYLE: normal; WIDTH: 75px">
                  <option value="dateh" >发帖时间 
                  <option value="redate">跟帖时间 
                  <option value="hit" >浏览量 
                  <option value="rep" >跟帖数 
                </select>
                  <input name="layer_2" type="hidden" id="layer_2" value="<?=layer_2?>">
				  <input name="layer_1" type="hidden" id="layer_1" value="<?=layer_1?>">
                </div>
            </td>
          </form>
        </tr>
        </tbody> 
      </table>
    </td>
  </tr>
</table>
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center" class="pagenavborder">
    <tr class="maintbtr1">
	 <td align="left" height="26" class="f12"><?$p->output(0);?></td> 
     <td align="right" width="200" class="f12">
	 <table cellspacing=1 cellpadding=1 style="font-family: Tahoma, Verdana;BORDER: #8C8E7B 1px solid;background:#FFFFFF;">
     <tr> 
     <td style="background:#FF6500;font-size: 7pt;color:#ffffff;">&nbsp;XML&nbsp;</td>
     <td style="background:#8C8E7B;font-size: 7pt;">&nbsp;<a href="rss.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>" target="_blank" title="订阅本版面最新帖子"><font color='#ffffff'>RSS 
     2.0</font></a>&nbsp;</td>
     </tr>
     </table>
	 </td>
   </tr>
</table>
<?php
if ($layer_1!="" && $layer_2==""){
$mainurl="main.php?layer_1=".$layer_1;
}
elseif ($layer_1!="" && $layer_2!=""){
$mainurl="main.php?layer_1=".$layer_1."&layer_2=".$layer_2;
}else{
$mainurl="main.php";
}
if ($jh==1){
$jhcss='class="current"';
}elseif ($tj==1){
$tjcss='class="current"';
}elseif ($flag==1){
$flagcss='class="current"';
}elseif ($flag==2){
$fdcss='class="current"';
}else{
$allcss='class="current"';
}
?>
<div align="center">
 <div id="postflag">
	<ul class="tabs">
		<li <?=$allcss?>><a href="<?=$mainurl?>">全部</a></li>
		<li <?=$tjcss?>><a href="main.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&sign=1">推荐</a></li>
		<li <?=$jhcss?>><a href="main.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&huati=1">精华</a></li>
		<li <?=$flagcss?>><a href="main.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&flag=1">投票</a></li>
        <li <?=$fdcss?>><a href="main.php?layer_1=<?=$layer_1?>&layer_2=<?=$layer_2?>&flag=2">活动</a></li>
	</ul>
 </div>
</div>
<table width="99%" border=0 cellpadding=2 cellspacing=0 class="listborder" align="center">
        <tbody>
          <tr align=middle class="f12"> 
            <td width="6%" height="28" class="loopborder1">状态</td>
            <td width="52%" class="loopborder1">主题</td>
            <td width="9%" class="loopborder1">作者</td>
            <td width="6%" class="loopborder1">回复</td>
            <td width="6%" class="loopborder1">点击</td>
            <td width="25%" class="loopborder1">最后更新</td>
          </tr>
<!--<script src="bbsad.js"></script>-->
<?
if ($myrow = mysql_fetch_array($rs)){
$i=0;
if ($numrows>0){
do {
    $i++;
	$indbdate=$myrow["dateh"];
	$indbdate=dateFormat($indbdate,'y-m-d H:i'); 
	$titlecolor=$myrow["titlecolor"];
	$bbstitle=$myrow["title"];
	$postname=$myrow["name"];
	$bbs_img_display=$myrow["bbs_img_display"];
	$bbs_img=$myrow["bbs_img"];
	
	if ($htmlsign==1){
	$readurl="ftbbs-".$myrow["ID"].".html";
	}
	else{
	$readurl="ftbbs.php?id=".$myrow["ID"];
	}
	if ($titlecolor!=""){
	$title="<font color=".$titlecolor.">".$bbstitle."</font>";
	}
	else{
	$title=$bbstitle;
	}
	$reinfo=$myrow["reinfo"];
	if (strrpos($reinfo,"||")){
	$rearr=explode("||",$reinfo);
	$arrnum=count($rearr)-1;
	$reinfo=$rearr[$arrnum];
	}
	if (reinfo!="" && strrpos($reinfo,",")){
	$reinfo=str_replace("|","",$reinfo);
	$rearr=explode(",",$reinfo);
	$replydate=$rearr[0];
	$replydate=dateFormat($replydate,'y-m-d H:i');
	$replyuser=" <font color=red>|</font> <a class=map href=ftbbsmyinfo.php?ftbbsuser=".$rearr[1].">".$rearr[1]."</a>";
	}
	else{
	$replydate=$indbdate;
	$replyuser=" <font color=red>|</font> <a class=map href=ftbbsmyinfo.php?ftbbsuser=".$postname.">".$postname."</a>";
	}
?>
          <tr align=middle> 
            <td width="4%" height="28" class="loopborder1">
              <?
			  if ($myrow["bbstop1"]=="1"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/ding.gif" alt="总固顶的主题&#xA;点击开新窗口浏览" width="15" height="13" border="0" align="absmiddle" board=0></a>';
              }
			  elseif ($myrow["bbstop"]=="1"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/blueding.gif" width="15" height="13" align="absmiddle" border="0" alt="分论坛固顶的主题&#xA;点击开新窗口浏览"></a>';
              }
			  elseif ($myrow["sign"]=="1"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/jian.gif" width="15" height="13" align="absmiddle" border="0" alt="版主推荐的话题&#xA;点击开新窗口浏览"></a>'; 
              }
			  elseif ($myrow["huati"]=="1"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/jing.gif" width="15" height="13" align="absmiddle" border="0" alt="版主精选的话题&#xA;点击开新窗口浏览"></a>';
              }
			  elseif ($myrow["P_display"]=="0"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/suo.gif" width="12" height="13" align="absmiddle" border="0" alt="分论坛固顶的主题&#xA;点击开新窗口浏览"></a>';
              }
			  elseif ($myrow["flag"]=="1"){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/poll.gif" width="15" height="16" align="absmiddle" border="0" alt="投票主题&#xA;点击开新窗口浏览"></a>';
              }
			  elseif ($myrow["hit"]>=500){
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/hotpost.gif" width="14" height="16" align="absmiddle" border="0" alt="热门的话题&#xA;点击开新窗口浏览"></a>'; 
              }
			  else{
              echo '<a class=f14 href='.$readurl.' target="_blank"><img src="images/normal.gif" width="14" height="16" align="absmiddle" border="0" alt="开放的话题&#xA;点击开新窗口浏览"></a>'; 
              }
			  ?>
            </td>
            <td width="52%"  align=left valign="middle" class="loopborder2">
              <?if ($myrow["P_display"]!="0" && $myrow["bbstop"]!=1 and $myrow["sign"]!="1" && $myrow["huati"]!="1" && $myrow["zhiye"]!="10" && $myrow["picture"]!=""){?>
              <img src="images/<?=$myrow["picture"]?>" width="19" height="19" align="absmiddle"> 
              <?}?>
              <a class=f14 href="<?=$readurl?>" title="<?=$myrow["title"]?>&#xA;作者:<?=$myrow["user_id"]?>&#xA;发表于:<?=$myrow["dateh"]?>" target="_blank"><?=$title?></a>
              <?
			  if ($bbs_img_display==1){
			  echo "<img src=\"images/picflag.gif\" width=\"13\" height=\"13\" align=\"absmiddle\" alt=\"附带图片\">";
			  }else if ($bbs_img_display==3){
			  echo "<img src=\"images/file.gif\" align=\"absmiddle\" alt=\"附件\">";
			  }
			  $pagenum=$ftbbsmb[6];//'贴子每页显示条数
              $k=$myrow["rep"]/$pagenum;
			  if (is_int($k)){
			  $repage=intval($k);
			  }else{
			  $repage=intval($k)+1;
			  }
			  if ($repage>1){
			    //echo "[";
				for ($i=0;$i<$repage;$i++){
				   if ($htmlsign==1){
				   $pagehtm='ftbbs-'.$myrow['ID'].'-'.($i+1).'.html';
				   }
				   else{
				   $pagehtm='ftbbs.php?page='.($i+1).'&id='.$myrow['ID'];
				   }
				   if ($i>=4 && $repage>6){
				      if ($htmlsign==1){
					  $pagehtm='ftbbs-'.$myrow['ID'].'-'.$repage.'.html';
					  }
					  else{
				      $pagehtm='ftbbs.php?page='.$repage.'&id='.$myrow["ID"];
					  }
				      echo '..<a class="mainouttd" href='.$pagehtm.' target="_blank">'.$repage.'</a>';
					  break;
				   }
				   if ($i==0){
				   echo '<a class="mainouttd" href='.$pagehtm.' target="_blank">'.($i+1).'</a>';
				   }
				   else{
				   echo '<a class="mainouttd" href='.$pagehtm.' target="_blank">'.($i+1).'</a>';
				   }
				}  
				//echo "]";
			  }
			?>
			</td>
            <td width="7%" class="loopborder1"><a href="ftbbsmyinfo.php?ftbbsuser=<?=$myrow["user_id"]?>"><?=$myrow["user_id"]?></a></td>
            <td width="5%" class="loopborder3"> <?=$myrow["rep"]?></td>
            <td width="6%" class="loopborder3"><?=$myrow["hit"]?></td>
            <td width="25%" class="loopborder1"><div align="left"><?=$replydate?><?=$replyuser?></div></td>
          </tr>
<?
}
while ($myrow = mysql_fetch_array($rs));
}
?>
          <tr valign="top"> 
            <td colspan="7" class="maintbtr1"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                <tr>
				  <td align="left" height="26" class="f12">
<?
$p->output(0);
mysql_free_result($qsrs);
mysql_free_result($rs);
$db->close(); 
?>
</td> 
                  <td align="right" width="200" class="f12"><script src="ftbbsdh.js"></script></td>
                </tr>
<?}else{?>
          <tr class="maintbtr3"> 
            <td colspan=7 align=center height=25 class="f12"> 欢迎到本论坛发表贴子！ </td>
          </tr>
<?}?>
              </table></td>
          </tr>
        </tbody>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr> 
    <td height=3><spacer height="3" type="block"></td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" class="maintbbg">
  <tr> 
    <td height=25 class="f12bg">&nbsp;-=&gt; 帖子图例</td>
  </tr>
  <tr> 
    <td height="28" class="maintbtr3"><table width="100%" border="0" cellspacing="6" cellpadding="0">
        <tr> 
          <td width="13%" height="25" class="maintbtr3"><img src="images/normal.gif" width="14" height="16" border="0" align="absmiddle" board=0> 
            普通主题</td>
          <td width="14%" class="maintbtr3"><img src="images/hotpost.gif" width="14" height="16" border="0" align="absmiddle" board=0> 
            热门主题</td>
          <td width="14%" class="maintbtr3"><img src="images/suo.gif" width="12" height="13" border="0" align="absmiddle" board=0> 
            锁定主题</td>
          <td width="14%" class="maintbtr3"><img src="images/jing.gif" width="15" height="13" border="0" align="absmiddle" board=0> 
            精华主题</td>
          <td width="14%" class="maintbtr3"><img src="images/jian.gif" width="15" height="13" border="0" align="absmiddle" board=0> 
            推荐主题</td>
          <td width="14%" class="maintbtr3"><img src="images/poll.gif" width="15" height="16" border="0" align="absmiddle" board=0> 
            投票主题</td>
          <td width="16%" class="maintbtr3"><img src="images/ding.gif" width="15" height="13" border="0" align="absmiddle" board=0 alt="总版固顶"> 
            <img src="images/blueding.gif" width="15" height="13" border="0" align="absmiddle" board="0" alt="分版固顶"> 
            固顶主题</td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr> 
    <td height=5><spacer height="5" type="block"></td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" class="maintbbg">
<?if (onlineoff==0){?>
  <tr> 
    <td height=25 class="f12bg">&nbsp;在线用户:
<script language="JavaScript" src="online.php?dis=yes&stats=<?=$stats?>"></script>
	  </td>
  </tr>
<?}?>
<?if (linkoff==0){?>
  <tr> 
    <td height="28" class="maintbtr3"><table width="100%" border="0" cellspacing="6" cellpadding="0">
        <tr> 
          <td class="maintbtr3"><script language="JavaScript" src="ftlink.js"></script></td>
        </tr>
      </table></td>
  </tr>
<?}?>
</table>
<script>
if(stylecook=='' || stylecook == '0' )
{
stylecook=0;
}
document.all.select3.value=stylecook;
</script>
<?
include_once("inc/bbstail.php");
?>
</body>
</html>