<?php
include("require.php");
submitfilter($_GET['id']);
$phpcolor->table="class";
$phpcolor->field="*";
$phpcolor->where="id = ".$_GET['id']."";
if(!($sort=$phpcolor->exist(1)))
  jump("index.php");
?>
<html>
<head>
<title><?php echo $sort['classname'];?> - <?php echo $core_bartype; ?>分类 - <?php echo $core_barname; ?> - 做最开放的中文社区</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size:12px; line-height:150%">
  <tr>
    <td><img src='logo.gif' alt="多彩贴吧"/></td>
  </tr>
  <tr>
    <td bgcolor="#EDF8FC">
	  <a href='index.php'>首页</a>&nbsp;
	  <?php
	    if(isset($_COOKIE["corew_user_name"]))
		  echo $_COOKIE["corew_user_name"]."&nbsp;<a href='action.php?action=quit'>退出</a>";
		else
		  echo "<a href='login.php'>登录</a>&nbsp;<a href='reg.php'>注册</a>";
	  ?>
	</td>
  </tr>
  <form action="action.php?action=gobar" method="post">
  <tr>
    <td><input name="searchname" type="text" size="15" maxlength="30" />&nbsp;&nbsp;<input type="submit" value="进入<?php echo $core_bartype; ?>" /></td>
  </tr>
  </form>
  <tr>
    <td valign="middle" height="35">
	  <?php
	  $phpcolor->table="bar";
      $phpcolor->field="id,barname";
      $phpcolor->where="recommend = 1 order by rand() limit 8";
      $bar=$phpcolor->assignment();
	  if(count($bar))
	  {
        echo "推荐".$core_bartype."：";
        for ($count=0;$count<count($bar);$count++)
        { 
          echo "&nbsp;&nbsp;<a href='list.php?bid=".$bar[$count]['id']."'>".$bar[$count]['barname']."</a>";
        }
      }
	  ?>
	</td>
  </tr>
  <?php
  if($sort['base']=="0")
  {
  ?>
  <tr>
    <td bgcolor="#EDF8FC">下属分类</td>
  </tr>
  <tr>
    <td>
	<?php
	$phpcolor->table="class";
    $phpcolor->field="id,classname";
    $phpcolor->where="belong = ".$_GET['id']." order by queue";
    $smallsort=$phpcolor->assignment();
    for ($count=0;$count<count($smallsort);$count++)
    { 
      echo "<a href='class.php?id=".$smallsort[$count]['id']."'>".$smallsort[$count]['classname']."</a><br>";
    }
	?> 
	</td>
  </tr>
  <?php
  }
  else
  {
  ?>
  <tr>
    <td bgcolor="#EDF8FC"><?php echo $core_bartype; ?>列表</td>
  </tr>
  <tr>
    <td>
	  <?php
	  if(!isset($_GET['page']))
        $_GET['page']=0;
	  submitfilter($_GET['page']);
      $page="";
      $phpcolor->table="bar";
      $phpcolor->field="*";
      $phpcolor->where="barclass = '".$_GET['id']."'";
      $count=$phpcolor->exist(2);
      if($count>10)
      {
        $count=ceil($count/10);
        for($i=0;$i<$count;$i++)
        {
          $page=$page." <a href='class.php?id=".$_GET['id']."&page=".$i."'>".($i+1)."</a>";
        }
      }
      $phpcolor->field="id,barname";
      $phpcolor->where="barclass = '".$_GET['id']."'  order by rankings desc limit ".($_GET['page']*10).",10";
      $bar=$phpcolor->assignment();
      for ($count=0;$count<count($bar);$count++)
      {
        echo "<a href='list.php?bid=".$bar[$count]['id']."'>".$bar[$count]['barname']."</a><br>";
      }
      echo $page;
	  ?>
	</td>
  </tr>
  <?php
  }
  ?>
  <tr><td>Copyright 2010-2014 phpcolor.com 版权所有 <?php echo $core_wflow; ?></td></tr>
</table>
</body>
</html>