<?php
include_once("inc/config.php");
include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/pageclass.php");
include_once("conn.php");
include_once("ftbbshome_nav.php");
$ftbbs_name=get_cookie('username');
$ftbbs_bz=get_cookie('bz');
$ftbbs_bbsadmin=get_cookie('bbsadmin');
$ftbbs_payuser=get_cookie('payuser');
if ($ftbbs_name!="" && $ftbbs_bz==""){
   $ftbbs_bz=0;
}
$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];
$sitenav=$ftbbsmb[61];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>飞天论坛,静态论坛,生成静态贴子的论坛</title>
<meta name="keywords" content="飞天论坛,静态论坛,生成静态贴子的论坛">
<script language=javascript src="js/ajax.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="default0"+stylecook+".css";
strstyle="<link href=\"css/"+style+"\"  rel=\"stylesheet\" type=\"text/css\"> ";
document.write(strstyle);
</script>
<script>
function changeCssStyle()
{
	var sCssType = document.getElementById('select3').value;
	setCookie("STYLESHOW", sCssType);
    window.location.href='ftbbshome.php';
    parent.left.document.location.reload();
}
function show_tbl(pre,n,select_n)
{
	for(i=1;i<=n;i++)
	{
		var tbl= document.getElementById(pre+i);
		tbl.style.display="none";
		if(i==select_n)
		{
		tbl.style.display="block";
		}
	}
}
</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>
<?
echo $sitenav;
include_once("navhome.php");
//cache
include('cacheclass.php');
$cache = new ftbbscache('cache/ftbbshome.txt',$expire);

if ($ftbbs_name==""){
   $strqssql="where BBS_Cate_Qs=1 or BBS_Cate_Qs=2 or BBS_Cate_Qs=3";
}
else{
   if ($ftbbs_payuser==1 && $ftbbs_bz==0 && $ftbbs_bbsadmin==0){
      $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";
   }
}

$strqs="";
$qssqlstr1="";
//$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!=""){
    $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;
}
$sql="select {$tablepre}bbstitle.ID,{$tablepre}bbstitle.title,{$tablepre}ftbbs_upload.upload_pic from {$tablepre}bbstitle,{$tablepre}ftbbs_upload where {$tablepre}bbstitle.htmfilename={$tablepre}ftbbs_upload.upload_htm and {$tablepre}bbstitle.deleted=0 and {$tablepre}ftbbs_upload.sign=3 and {$tablepre}ftbbs_upload.bbs_blog_type=0 and ({$tablepre}ftbbs_upload.upload_ext='jpg' or {$tablepre}ftbbs_upload.upload_ext='gif') order by {$tablepre}bbstitle.ID desc limit 0,5";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
?>
		<base target="_blank" />
		<!--主栏目1开始-->
		<div class="width780" id="MainBody">
			<div class="MbLeft">
				<div id="slideimg">
				<script type="text/javascript" language="javascript">
				<!--			
				var xsTextBar = 1; //是否显示文字链接，1为显示，0为不显示
				var xsPlayBtn = 0; //是否显示播放按钮，1显示，0为不显示
				var xsImgSize = new Array(214,235); //幻灯图片的尺寸，格式为“宽度,高度”

				var xsImgs = new Array();
				var xsImgLinks = new Array();
				var xsImgTexts = new Array();
				<?
		        $i=0;
		        if ($numrows!=0){
				   do {
				      if ($htmlsign==1){
	                  $readurl="ftbbs-".$myrow["ID"].".html";
                      }else{
	                  $readurl="ftbbs.php?id=".$myrow["ID"];
                      }
				?>
				xsImgs[<?=$i?>] = "<?=$myrow["upload_pic"]?>";
				xsImgLinks[<?=$i?>] = "<?=$readurl?>";
				xsImgTexts[<?=$i?>] = "<?=$myrow["title"]?>";
				<?
				      $i++;
				      }
				   while ($myrow = mysql_fetch_array($rs));
                }
				?>
				//-->
				</script>
				<script language="javascript" type="text/javascript" src="js/slide.js"></script>
				</div>
				<div id="TodayStar" class="TodayStar">
					<h1><img alt="" src="blogimages/star.gif" width="32" height="23" align="middle" />最新博客</h1>
					<div class="TodayStarPicBlock">
<?
$sql="select clubuser_id,clubuser_name,userimg from {$tablepre}clubuser where payuser<>3 and bokeer=1 order by clubuser_id desc limit 0,2";
$rs1=mysql_query($sql);
$myrow1 = mysql_fetch_array($rs1);
$numrows1 = mysql_num_rows($rs1);
$i=0;
do {
    if ($htmlsign==1){
	   $blogurl=$myrow1["clubuser_id"].".html";
    }
    else{
	   $blogurl="home.php?userid=".$myrow1["clubuser_id"];
    }
?>
						<div class="TodayStarPic">
							<a href="<?=$blogurl?>"><img alt="<?=$myrow1["clubuser_name"]?>" src="userheadimg/<?=$myrow1["userimg"]?>" width="89" height="75" border="0" /></a><div><a href="<?=$blogurl?>"><?=$myrow1["clubuser_name"]?></a></div>
						</div>
<?
$i++;
}
while ($myrow1 = mysql_fetch_array($rs1));
?>
					</div>
				</div>
			</div>
			<div class="MbCenter">
				<!--站内搜索开始-->
				<div class="SearchForm">
					<form method="post" action="search.php" style="display: inline;" target="_self">
						
        <input name="searchcontent" type="text" size="23" />
        <select name="searchkind" style="background-color:#ffffff;FONT-FAMILY: Arial; FONT-SIZE: 9pt; FONT-STYLE: normal; WIDTH: 65px">
                  <option value="title" selected>按主题</option>
                  <option value="user_id" >按作者</option>
				  <option value="menu" >按内容</option>
                </select>
							</span>
						</span>
						<button name="loginsubmit" type="submit" value="true"><span class="search">Search</span></button>
      <select name="select3"  style="background-color:#ffffff;FONT-FAMILY: Arial; FONT-SIZE: 9pt; FONT-STYLE: normal; WIDTH: 83px" 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>
					</form>
				</div>
				<!--站内搜索结束-->
				<!--最新发表开始-->
				<div class="TitleMore">
				<div class="left">最新贴子</div>
                 <div class="right"><a class="menu" href="main.php" target="_self">MORE</a></div>
				</div>
				<div class="NewlyPost">
					<div class="NewlyPostList">
					<ul>
					<?
					$sql="select id,title,dateh,redate,titlecolor from {$tablepre}bbstitle where ".$strqs." deleted=0 order by boardsign desc,redate desc limit 0,15";
                    $rs2=mysql_query($sql);
					$myrow2 = mysql_fetch_array($rs2);
                    $numrows2 = mysql_num_rows($rs2);
                    $i=0;
                    do {
					$title=$myrow2["title"];
					$titlecolor=$myrow2["titlecolor"];
					if ($titlecolor!=""){
					$title="<font color=".$titlecolor.">".$title."</font>";
					}
                    if ($htmlsign==1){
	                $readurl="ftbbs-".$myrow2["id"].".html";
                    }
                    else{
	                $readurl="ftbbs.php?id=".$myrow2["id"];
                    }
					?>
					<li class="topth"><em><?=dateFormat($myrow2["redate"],'y-m-d H:i:s')?></em>·<a title="<?=$myrow2["title"]?>" href="<?=$readurl?>" target="_blank"><?=$title?></a></li>
					<?
                    $i++;
                    }
                    while ($myrow2 = mysql_fetch_array($rs2));
					?>
					</ul>
					</div>
				</div>
			</div>
			<div class="MbRight">
			<div id="loginhtml">Loading...</div>
				<div class="HotSpace"  id="t_1" name="t_1">
					<h2>发贴排行榜</h2><h4><a class="menu" href="javascript:show_tbl('t_',2,2)" target="_self">版块排行榜</a></h4>
					<ul>
					<?
					$sql="select clubuser_id,clubuser_name,postnum from {$tablepre}clubuser where payuser<>3 order by postnum desc limit 0,10";
                    $rs=mysql_query($sql);
                    $myrow = mysql_fetch_array($rs);
					$m=0;
					do {
                       if ($htmlsign==1){
	                          $blogurl=$myrow["clubuser_id"].".html";
                         }
                       else{
	                          $blogurl="home.php?userid=".$myrow["clubuser_id"];
                        }
					?>
					<div style="float:left;width:125px;text-align:left;padding-top: 6px;">&nbsp;&nbsp;<a title="<?=$myrow["clubuser_name"]?>" href="<?=$blogurl?>" target="_blank"><img alt="" src="images/ftbbs_img_<?=($m+1)?>.gif" align="absmiddle" /> <?=$myrow["clubuser_name"]?></a></div><div style="float:left;width:50px;text-align:right;padding-top: 7px;padding-right: 4px;"><?=$myrow["postnum"]?>&nbsp;&nbsp;</div>
				    <?
					$m++;
					}
					while ($myrow = mysql_fetch_array($rs));
				    ?>
					</ul>
			   </div>
				<div class="HotSpace" id="t_2" name="t_2" style="display:none">
					<h1><a class="menu" href="javascript:show_tbl('t_',2,1)" target="_self">发贴排行榜</a></h1><h3>版块排行榜</h3>
					<ul>
					<?
					$sql="select BBS_Cate_Name,BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Topic,BBS_Cate_Qs from {$tablepre}bbs_cate where BBS_Cate_PID<>'0' and deleted=0 order by BBS_Cate_Topic desc limit 0,10";
                    $rs=mysql_query($sql);
                    $myrow = mysql_fetch_array($rs);
					$m=0;
					do {
					?>
					<div style="float:left;width:125px;text-align:left;padding-top: 6px;">&nbsp;&nbsp;<a href="main.php?layer_1=<?=$myrow["BBS_Cate_PID"]?>&layer_2=<?=$myrow["BBS_Cate_ID"]?>&qs=<?=$myrow["BBS_Cate_Qs"]?>" target="_self"><img alt="" src="images/ftbbs_img_<?=($m+1)?>.gif" align="absmiddle" /> <?=$myrow["BBS_Cate_Name"]?></a></div><div style="float:left;width:50px;text-align:right;padding-top: 7px;padding-right: 4px;"><?=$myrow["BBS_Cate_Topic"]?>&nbsp;&nbsp;</div>
				    <?
					$m++;
					}
					while ($myrow = mysql_fetch_array($rs));
				    ?>
					</ul>
			   </div>
			</div>
		</div>
		<!--主栏目1结束-->
		<div class="mytag_list" style="margin-top: 0px;"></div>
		<!--广告条开始-->
		<!--<div class="width780" style="margin-top: 8px;"><img alt="" src="images/ad.gif" width="780" height="86" /></div>-->
		<!--广告条结束-->
		<!--文章导航区开始-->
		<div class="ArticleBlock">
			<div class="ArticleNavCenter">
				<h1><img alt="" src="blogimages/left01.gif" align="middle" /> 推荐/精华</h1>
				<ul>
					<li>&nbsp;</li>
				</ul>
				
    <h2><a href="main.php" target="_self"><img src="blogimages/more3.gif" alt="" border="0" style="padding-top:4px;" /></a></h2>
			</div>
		</div>
		<!--文章导航区结束-->
		<!--推荐阅读开始-->
		<div class="CommendRead">
			<div class="Left">
				<h3><img alt="" src="blogimages/icon_quote.gif" align="middle" /><font color="#000000">新置顶贴</font></h3><div>
				<?
				$sql="select id,title from {$tablepre}bbstitle where ".$strqs." deleted=0 and (bbstop=1 or bbstop1=1) order by redate desc limit 0,10";
                $rs=mysql_query($sql);
                $myrow = mysql_fetch_array($rs);
				$k=0;
                do {
				 $title=$myrow["title"];
				 //if (strlen($title)>15){
				   //$title=substr($title,0,24)."...";
				 //}
                    if ($htmlsign==1){
	                $readurl="ftbbs-".$myrow["id"].".html";
                    }
                    else{
	                $readurl="ftbbs.php?id=".$myrow["id"];
                    }
				?>
				<h2> ·<a title="<?=$title?>" href="<?=$readurl?>" target="_blank"><?=$title?></a></h2>
				<?
				$k++;
				}
                while ($myrow = mysql_fetch_array($rs));
				?>
				</div>
			</div>
			<div class="CenterAndRight">
				<div class="Content">
					<h1><img alt="" src="blogimages/green_arrow.gif" width="12" height="17" align="middle" /><a href="main.php?sign=1" target="_self"><font color="#000000">新推荐贴</font></a></h1>
					<ul>
					<?
					$sql="select id,title,htmfilename from {$tablepre}bbstitle where ".$strqs." deleted=0 and sign=1 order by redate desc limit 0,10";
                    $rs=mysql_query($sql);
                    $myrow = mysql_fetch_array($rs);
                    do {
					$title=$myrow["title"];
				    //if (strlen($title)>44){
				     //$title=substr($title,0,40)."...";
				    //}
                    if ($htmlsign==1){
	                $readurl="ftbbs-".$myrow["id"].".html";
                    }
                    else{
	                $readurl="ftbbs.php?id=".$myrow["id"];
                    }
					?>
					<li class="topth">·<a title="<?=$title?>" href="<?=$readurl?>" target="_blank"><?=$title?></a></li>
					<?
                    }
					while ($myrow = mysql_fetch_array($rs));
					?>
					</ul>
				</div>
			</div>
			<div class="CenterAndRight">
				<div class="Content">
					<h1><img alt="" src="blogimages/green_arrow.gif" width="12" height="17" align="middle" /><a href="main.php?huati=1" target="_self"><font color="#000000">新精华贴</font></a></h1>
					<ul>
					<?
					$sql="select id,title,htmfilename from {$tablepre}bbstitle where ".$strqs." deleted=0 and huati=1 order by redate desc limit 0,10";
                    $rs=mysql_query($sql);
                    $myrow = mysql_fetch_array($rs);
                    do {
					$title=$myrow["title"];
				    //if (strlen($title)>44){
				     //$title=substr($title,0,40)."...";
				    //}
                    if ($htmlsign==1){
	                $readurl="ftbbs-".$myrow["id"].".html";
                    }
                    else{
	                $readurl="ftbbs.php?id=".$myrow["id"];
                    }
					?>
					<li class="topth"> <a title="<?=$title?>" href="<?=$readurl?>" target="_blank"><?=$title?></a></li>
					<?
                    }
					while ($myrow = mysql_fetch_array($rs));
					?>
					</ul>
				</div>
			</div>
		</div>
		<!--推荐阅读结束-->
		<!--相册导航区开始-->
		<div class="ArticleBlock">
			<div class="ArticleNavCenter">
				<h1><img alt="" src="blogimages/left01.gif" align="middle" /> 精选图片</h1>
				<ul>
					<li>&nbsp;</li>
				</ul>
				<h2><a href="morepic.php" target="_self"><img src="blogimages/more3.gif" alt="" border="0" style="padding-top:4px;" /></a></h2>
			</div>
		</div>
		<div id="NewlyPhotos" class="width780">
		<?
		$sql="select {$tablepre}bbstitle.ID,{$tablepre}bbstitle.title,{$tablepre}ftbbs_upload.upload_pic,{$tablepre}ftbbs_upload.upload_htm,{$tablepre}ftbbs_upload.userid from {$tablepre}bbstitle,{$tablepre}ftbbs_upload where {$tablepre}bbstitle.htmfilename={$tablepre}ftbbs_upload.upload_htm and {$tablepre}bbstitle.deleted=0 and {$tablepre}bbstitle.flag=0 and {$tablepre}ftbbs_upload.sign=0 and {$tablepre}ftbbs_upload.bbs_blog_type=0 and ({$tablepre}ftbbs_upload.upload_ext='jpg' or {$tablepre}ftbbs_upload.upload_ext='gif') order by {$tablepre}bbstitle.ID desc limit 0,12";
        $rs=mysql_query($sql);
		$myrow = mysql_fetch_array($rs);
        $numrows = mysql_num_rows($rs);
		do {
		   $photo_name=$myrow["userid"];
           if ($htmlsign==1){
	          $readurl="ftbbs-".$myrow["ID"].".html";
           }
           else{
	          $readurl="ftbbs.php?id=".$myrow["ID"];
           }
		?>
		<h1><a href="<?=$readurl?>" target="_blank"><img src="<?=$myrow["upload_pic"]?>" alt="<?=$myrow["title"]?>" width="110" height="110" border="0" /></a></h1>
		<?
		}
		while ($myrow = mysql_fetch_array($rs));
		?>
		</div>
<?
include_once("copyright.htm");
?>
<script>
if(stylecook=='' || stylecook == '0' )
{
stylecook=0;
}
document.getElementById('select3').value=stylecook;
</script>
</body>
</html>
<?
include_once("endcache.php");
?>