<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("conn.php");
include_once("inc/ftcode.php");
$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$sitenav=$ftbbsmb[61];
include_once("sound.php");
include_once("ftbbs_nav.php");
if (get_cookie('ftbbstype')==""){
   set_cookie('ftbbstype',$ftbbsmb[8],time()+$expire);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?=$ftbbsmb[11]?></title>
<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>
<style type="text/css">
<!--
a:link {
	font-size: 12px;
	font-style: normal;
	line-height: 22px;
	text-decoration: none;
}
a:visited {
	font-size: 12px;
	font-style: normal;
	line-height: 22px;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	font-style: normal;
	line-height: 22px;
	color: #FF0000;
	text-decoration: underline;
}
#wrap{word-break:break-all; width:320px; overflow:hidden;}
-->
</style>
</head>
<script language="javascript">
<!--
	function check_search(form)
		{
		if (form.searchcontent.value=="")
			{
			alert("请输入搜索内容！");
			form.searchcontent.focus();
			return false;
			}
			return true;
		}
//-->
</script>
<body>
<center>
<?
include_once("pbhead.php");
?>
<table cellspacing=0 cellpadding=0 width="99%" align=center border=0>
    <tbody>
      <tr> 
        <td height=1></td>
      </tr>
    </tbody>
</table>
<table cellspacing=0 cellpadding=0 width="99%" align=center border=0>
    <tbody>
      <tr> 
        <td class="maintbtr1" height=2></td>
      </tr>
      <tr> 
        <td height=1></td>
      </tr>
    </tbody>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td height="25" class="maintbtr3" align="right">&nbsp;<?=$userinfo?>&nbsp;</td>
    </tr>
</table>
<?
//cache
include('cacheclass.php');
$cache = new ftbbscache('cache/default_list.txt',$expire);
$sql="select clubuser_id,clubuser_name from {$tablepre}clubuser order by clubuser_id desc limit 0,1";
$rs0=mysql_query($sql);
$myrow0 = mysql_fetch_array($rs0);
$clubuser_id=$myrow0["clubuser_id"];
$newmember=$myrow0["clubuser_name"];

$y=date("Y");
$m=date("m");
$d=date("d");
$t0=$y."-".$m."-".($d-1);
$t1=$y."-".$m."-".$d;
$t2=$y."-".$m."-".($d+1);

$sql="select sum(BBS_Cate_Topic) as k1,sum(BBS_Cate_Reply) as k2 from {$tablepre}bbs_cate where BBS_Cate_PID<>'0'";
$rs1=mysql_query($sql);
$myrow1 = mysql_fetch_array($rs1);
//$numrows1=$myrow1[0];
$titletotal=$myrow1["k1"];
$retotal=$myrow1["k2"];
$sql="select count(id) as daytotal from {$tablepre}bbstitle where dateh>'".$t1."' and dateh<'".$t2."'";
$rs2=mysql_query($sql);
$myrow2 = mysql_fetch_array($rs2);
$daytotal=$myrow2["daytotal"];
$sql="select count(id) as daytotal from {$tablepre}bbstitle where dateh>'".$t0."' and dateh<'".$t1."'";
$rs3=mysql_query($sql);
$myrow3 = mysql_fetch_array($rs3);
$zttotal=$myrow3["daytotal"];
?>
<table cellspacing=0 cellpadding=0 width="99%" align=center border=0>
    <tbody>
      <tr> 
        <td class="maintbtr1" height=2></td>
      </tr>
      <tr> 
        <td height=1></td>
      </tr>
      <tr> 
        <td><script src="listad.js"></script></td>
      </tr>
    </tbody>
  </table>
  <table width="99%" cellspacing="0" cellpadding="1" class="default_list">
    <tr> 
      <td> <table width="100%" align="center" cellpadding="0" cellspacing="1">
          <tr class="f12bg" align="center"> 
            <td height="25" colspan="3" align="right">欢迎新会员：<a href="home.php?userid=<?=$clubuser_id?>"><?=$newmember?></a> 
              今日发贴：<?=$daytotal?> 昨日：<?=$zttotal?> 主题总数：<?=$titletotal?> 贴子总数：<?=$retotal?> 
			  <a href="main.php?order_key=dateh">最新发布主题</a> <a href="main.php">最新回复主题</a> <a href="main.php?order_key=hit">热门话题</a>&nbsp;</td>
          </tr>
          <tr> 
            <td width="5%" height="25" class="maintbtr3"> <div align="center"><img src="images/anc.gif"> 
              </div>
            </td>
            <td width="46%" class="maintbtr3"> 
              <script src="df_listad.js"></script>
            </td>
            <td height="25" class="maintbtr3"> <FORM METHOD=POST ACTION="search.php" onSubmit="return check_search(this)" style="MARGIN-BOTTOM: 0px">
                论坛搜索 
                <input type=text name="searchcontent" size=35 value="" class="">
                <select name="searchkind" style="background-color:#ffffff;FONT-FAMILY: Arial; FONT-SIZE: 9pt; FONT-STYLE: normal; WIDTH: 73px">
                  <option value="title" selected>贴子主题</option>
                  <option value="user_id" >贴子作者</option>
				  <option value="menu" >主题内容</option>
				  <option value="remenu" >回贴内容</option>
                </select>
                <input name="search" src="images/d_search.gif" type="image" value="Submit" width="37" height="21" border="0" align="absmiddle">
              </form></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="99%" cellspacing="0" cellpadding="0" class="listborder">
    <tr>
    <td>
<table width="100%" align="center" cellpadding="0" cellspacing="0">
      <tr class="f12bg" align="center"> 
            <td width="8%" height="27">&nbsp;</td>
            <td width="45%">论坛分类 (<a href="default.php?ft=0" target="_top"><font color="#FF0000">框架结构浏览</font></a>)</td>
        <td width="7%">主题</td>
        <td width="7%">帖数</td>
            <td width="20%">最后发表</td>
            <td width="12%">版主</td>
      </tr>
<?
$sql="select BBS_Cate_Name,BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Qs,BBS_Cate_Note,BBS_Cate_Topic,BBS_Cate_Reply,BBS_Cate_Manager_Name from {$tablepre}bbs_cate where BBS_Cate_PID='0' and deleted=0 order by totop asc";
$rs=mysql_query($sql);
$row = mysql_fetch_array($rs);
do{
?>
      <tr> 
            <td height="28" colspan="7" class="loopborder3">&nbsp; <a href="main.php?layer_1=<?=$row["bbs_cate_id"]?>&qs=<?=$row["BBS_Cate_Qs"]?>"><b><font color="#000000">≡<?=$row["BBS_Cate_Name"]?>≡</font></b></a> 
            </td>
      </tr>
      <tbody id="category_30" style="">
<?
$sqla="select BBS_Cate_Name,BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Qs,BBS_Cate_Note,BBS_Cate_Topic,BBS_Cate_Reply,BBS_Cate_Manager_Name from {$tablepre}bbs_cate where BBS_Cate_PID='".$row["BBS_Cate_ID"]."' and deleted=0";
$rsa=mysql_query($sqla);
$rowa = mysql_fetch_array($rsa);
do{
$bzname=$rowa["BBS_Cate_Manager_Name"];
$bzname=str_replace("|",",",$bzname);
$BBS_Cate_ID=$rowa["BBS_Cate_ID"];
$BBS_Cate_Qs=$rowa["BBS_Cate_Qs"];
if ($BBS_Cate_Qs==1){
   $ft="ft4.gif";
}
elseif ($BBS_Cate_Qs==2){
   $ft="ft3.gif";
   }
elseif ($BBS_Cate_Qs==3){
   $ft="ft2.gif";
   }
else{
   $ft="ft1.gif";
}

if (strrpos($bzname,",")){
	$arr=explode(",",$bzname);
	$bz="";
    for($i=0; $i<count($arr); $i++){
       $bz=$bz." <a href=ftbbsmyinfo.php?ftbbsuser=".$arr[$i].">".$arr[$i]."</a>";
    }
	$bzname=$bz;
}
else{
    $bzname="<a href=ftbbsmyinfo.php?ftbbsuser=".$bzname.">".$bzname."</a>";
}
	//$y=date("Y");
	//$m=date("m");
	//$d=date("d");
	$sqlstr="select count(*) from {$tablepre}bbstitle where BoardID_2='".$BBS_Cate_ID."' and year(dateh)='".$y."' and month(dateh)='".$m."' and day(dateh)='".$d."'";
	$rsb=mysql_query($sqlstr);
    $myrow = mysql_fetch_array($rsb);
    $numrows=$myrow[0];
	//echo $numrows;		  
?>
        <tr> 
          
              <td height="40" align="center" class="loopborder1"><img src="images/<?=$ft?>" alt="" width="25" height="32" /></td>
              <td class="loopborder1" align="left" style="line-height: 20px;color: #666;"> 
                <a href="main.php?layer_1=<?=$rowa["BBS_Cate_PID"]?>&layer_2=<?=$rowa["BBS_Cate_ID"]?>&qs=<?=$rowa["BBS_Cate_Qs"]?>"><span class="bold"><font color="#000000"><strong>◇ 
                -<?=$rowa["BBS_Cate_Name"]?>
                </strong></font></span></a><font color=#336699>(今日:
                <?=$numrows?>
                )</font><br>
                <?=ubb($rowa["BBS_Cate_Note"])?></td>
        <td class="loopborder1" align="center" style="line-height: 20px;color: #666;"><?=$rowa["BBS_Cate_Topic"]?></td>
        <td class="loopborder1" align="center" style="line-height: 20px;color: #666;"><?=$rowa["BBS_Cate_Reply"]?></td>
              <td class="loopborder1" align="right" style="line-height: 20px;color: #666;" title="" nowrap><div id="wrap"> 
    <?
    $str="select id,name,title,dateh,reinfo from {$tablepre}bbstitle where BoardID_2='".$rowa["BBS_Cate_ID"]."' and deleted=0 order by id desc limit 0,1";
    $rsc=mysql_query($str);
    $myrow = mysql_fetch_array($rsc);
	$title=$myrow["title"];
	$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:s');
	$replyuser="by&nbsp;<a class=map href=ftbbsmyinfo.php?ftbbsuser=".$rearr[1].">".$rearr[1]."</a>";
	}
	else{
	$replydate=$myrow["dateh"];
	$replyuser="by&nbsp;<a class=map href=ftbbsmyinfo.php?ftbbsuser=".$myrow["name"].">".$myrow["name"]."</a>";
	}
	?>
                <a class=map href="ftbbs.php?id=<?=$myrow["id"]?>" target="_blank"><?=$title?></a>&nbsp;<div>
                <?=$replyuser?> - <?=$replydate?>&nbsp;</div> 
              </div>
			  </td>
              <td class="loopborder1" align="center"><?=$bzname?></td>
        </tr>
  <? 
  }
  while ($rowa = mysql_fetch_array($rsa));
  ?>
<?
 }
while ($row = mysql_fetch_array($rs));
 ?>
    </table>
	</td>
  </tr>
</table>
<table width="99%" cellspacing="0" cellpadding="1" class="default_list">
    <tr>
    <td>
        <table width="100%" align="center" cellpadding="0" cellspacing="1">
          <tr class="f12bg" align="center"> 
            <td height="26"><div align="left">&nbsp;<strong>论坛及来访信息</strong></div></td>
          </tr>
          <tr> 
            <td height="28" class="maintbtr3">&nbsp;你的系统:&nbsp;<?=sysinfo()?> &nbsp;<?=browser()?>
              你的IP地址:<?=GetUserIP()?> </td>
          </tr>
          <tr> 
            <td height="28" class="maintbtr3">&nbsp;在线情况: 
              <script language="JavaScript" src="online.php?dis=yes&stats=论坛首页"></script></td>
          </tr>
          <tbody id="category_30" style="">
        </table>
	</td>
  </tr>
</table>
  <table width="99%" cellspacing="0" cellpadding="1" class="default_list">
    <tr> 
      <td> <table width="100%" align="center" cellpadding="0" cellspacing="1">
          <tr class="f12bg" align="center"> 
            <td height="25" colspan="5"><div align="left">&nbsp;<strong>论坛图例</strong></div></td>
          </tr>
          <tr> 
            <td width="20%" height="50" class="maintbtr3" align="center"><img src="images/ft1.gif" width="25" height="32" align="absmiddle">允许所有用户访问</td>
            <td width="20%" class="maintbtr3" align="center"><img src="images/ft2.gif" width="25" height="32" align="absmiddle">允许版主管理员访问</td>
            <td width="20%" class="maintbtr3" align="center"><img src="images/ft3.gif" width="25" height="32" align="absmiddle">允许认证用户访问</td>
            <td width="20%" class="maintbtr3" align="center"><img src="images/ft4.gif" width="25" height="32" align="absmiddle">允许注册用户访问</td>
            <td width="20%" class="maintbtr3" align="center"><img src="images/ft5.gif" width="25" height="32" align="absmiddle">论坛被关闭</td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="99%" cellspacing="0" cellpadding="1" class="default_list">
    <tr> 
      <td> <table width="100%" align="center" cellpadding="0" cellspacing="1">
          <tr class="f12bg" align="center"> 
            <td height="26"><div align="left">&nbsp;<strong>友情链接</strong></div></td>
          </tr>
          <tr> 
            <td height="25" 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></td>
    </tr>
  </table>
<?
mysql_free_result($rs);
mysql_free_result($rsa);
mysql_free_result($rsb);
mysql_free_result($rsc);
$db->close(); 
include_once("inc/bbstail.php");
?>
</center>
</body>
</html>
<?
include_once("endcache.php");
?>