<?php
include_once("inc/config.php");
include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("conn.php");

$id=$_GET["id"];
$n=$_GET["n"];
$a=$_GET["a"];
$b=$_GET["b"];
$ft=$_GET["ft"];
$postuserid=$_GET["userid"];

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$defaulthome=$ftbbsmb[31];
//echo get_cookie('ftbbstype');
//exit;
if ($ft!=""){
   set_cookie('ftbbstype',$ft,time()+$expire);
}
if (get_cookie('ftbbstype')=="" && $ft==""){
   set_cookie('ftbbstype',$ftbbsmb[8],time()+$expire);
}

if (get_cookie('ftbbstype')==1){
  if ($id!="" && $n==""){
      header("Location:ftbbs.php?id=".$id);
	  }
  elseif ($n=="regist"){
      header("Location:register.php");
	  }
  elseif ($n=="grzl"){
      header("Location:ftbbsmyinfo.php?ftbbsuserid=".$postuserid);
	  }
  elseif ($n=="help"){
     header("Location:help.php");
     }
  elseif ($n=="userinfo"){
     header("Location:moduserinfo.php");
	 }
  elseif ($n=="friend"){
     header("Location:myfriend.php");
	 }
  elseif ($n=="sms"){
     header("Location:mysms.php");
	 }
  elseif ($n=="postsms"){
     header("Location:smsbbs.php?postuser=".$postuserid);
	 }
  elseif ($n=="exit"){
     header("Location:main.php?exit=yes");
	 }
  elseif ($n=="myself"){
     header("Location:main.php?searchkind=name&searchcontent=".get_cookie('username'));
	 }
  elseif ($n=="myrepost"){
     header("Location:search.php?searchkind=myrepost&searchcontent=".get_cookie('username'));
     }
  elseif ($n=="favorties"){
     header("Location:myfavorties.php");
     }
  elseif ($n=="fbht"){
     header("Location:fbht.php?fd=0&layer_1=".$a."&layer_2=".$b);
     }
  elseif ($n=="poll"){
     header("Location:fbht.php?fd=1&layer_1=".$a."&layer_2=".$b);
     }
  else{
    if ($a=="" && $b==""){
	   header("Location:default_list.php?layer_1=".$a."&layer_2=".$b);
	   }
    else{
	   header("Location:main.php?layer_1=".$a."&layer_2=".$b);
    }
   }	
}
else{
$opentree="ftbbstree.htm";
if ($id!="" && $n==""){
//if ($id!=""){
  $urlfile="ftbbs.php?id=".$id;
  }
elseif ($n=="regist"){
  $urlfile="register.php";
  }
elseif ($n=="grzl"){
  $urlfile="ftbbsmyinfo.php?ftbbsuserid=".$postuserid;
  }
elseif ($n=="help"){
  $urlfile="help.php";
  }
elseif ($n=="userinfo"){
  $urlfile="moduserinfo.php";
  }
elseif ($n=="friend"){
  $urlfile="myfriend.php";
  }
elseif ($n=="sms"){
  $urlfile="mysms.php";
  }
elseif ($n=="postsms"){
  $urlfile="smsbbs.php?postuser=".$postuserid;
  }
elseif ($n=="exit"){
  $urlfile="main.php?exit=yes";
  }
elseif ($n=="myself"){
  $urlfile="main.php?searchkind=name&searchcontent=".get_cookie('username');
  }
elseif ($n=="myrepost"){
  $urlfile="search.php?searchkind=myrepost&searchcontent=".get_cookie('username');
  }
elseif ($n=="favorties"){
  $urlfile="myfavorties.php";
  }
elseif ($n=="fbht"){
  $urlfile="fbht.php?fd=0&layer_1=".$a."&layer_2=".$b;
  }
elseif ($n=="poll"){
  $urlfile="fbht.php?fd=1&layer_1=".$a."&layer_2=".$b;
  }
else
  if ($defaulthome==1 && $a=="" && $b==""){
  $urlfile="ftbbshome.php"; //开启首页调用
  }
  else{
  $urlfile="main.php?layer_1=".$a."&layer_2=".$b;
  }
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE><?=$ftbbsmb[11]?>,PHP论坛,静态论坛,最快的论坛</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<link rel="shortcut icon" href="favicon.ico" />
<script language=javascript src="inc/cookies.js"></script>
<script>
function defaultCssStyle()
{
	var sCssType =<?=$ftbbsmb[29]?> //默认的样式值
	setCookie("STYLESHOW", sCssType);
}
</script>
<script>
var stylecook = getCookie("STYLESHOW");
var style;
var strstyle;
if(stylecook=="" || typeof(stylecook)=="undefined")
{
 defaultCssStyle();
 stylecook=<?=$ftbbsmb[29]?>+1;
}
else
{
 stylecook++;
}
style="main0"+stylecook+".css";
strstyle="<link href=\"css/"+style+"\"  rel=\"stylesheet\" type=\"text/css\"> ";
document.write(strstyle);
</script>

<script language=javascript>
if(self!=top){top.location=self.location;}
function switchSysBar(){
	var obj=document.getElementById('left');
	var menu=document.getElementById('switchPoint');
	if(obj.style.display=='none'){
		obj.style.display='';
		menu.innerHTML = "<img src=\"images/ftbbs_close.gif\" style=\"cursor:pointer;\" alt=关闭左栏>";
	}else{
		obj.style.display='none';
		menu.innerHTML = "<img src=\"images/ftbbs_open.gif\" style=\"cursor:pointer;\" alt=打开左栏>";
	}
}
</script>

<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()',10);
</script>
<BODY scroll=no style="MARGIN: 0px">
<TABLE border=0 cellPadding=0 cellSpacing=0 height="100%" width="100%">
  <TBODY>
  <TR>
    <TD align=middle id=frmTitle noWrap vAlign=center>
	<IFRAME frameBorder=0 id="left" name=left scrolling=yes src="<?=$opentree?>" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 140px; Z-INDEX: 2"></IFRAME>
	</TD>
    <td>
	<table height="100%" width="12" cellspacing="0" cellpadding="0" class="nar">
	  <tbody>
	    <tr>
	      <td align="center" id="switchPoint" onclick="switchSysBar();" height="100%">
	      <img src="images/ftbbs_close.gif" style="cursor:pointer;" alt=关闭左栏>
	      </td>
	    </tr>
	  </tbody>
	</table>
    </td>
    <TD style="WIDTH: 100%">
	<IFRAME frameBorder=0 id="main" name=main scrolling=yes src="<?=$urlfile?>" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1"></IFRAME>
	</TD>
  </TR>
  </TBODY>
</TABLE>
<SCRIPT>
if(window.screen.width<'1024'){switchSysBar()}
</SCRIPT>
</BODY>
</HTML>