<?php
include("require.php");
?>
<html>
<head>
<title><?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 != 0 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>
  <tr>
    <td bgcolor="#EDF8FC" style="font-size:14px;">热门话题</td>
  </tr>
  <tr>
    <td>
	<?php
	$phpcolor->table="index";
    $phpcolor->field="*";
    $phpcolor->where="type = 4 and belong = 0 and barname='' order by id desc limit 3";
    $headlines=$phpcolor->assignment();
    for ($count=0;$count<count($headlines);$count++)
    {
      echo "<a style='font-weight:bolder' href='read.php?id=".$headlines[$count]['yid']."'>".$headlines[$count]['theme']."</a><br>";
      $phpcolor->where="type = 4 and belong = ".$headlines[$count]['yid']." order by id limit 4";
      $posttj[$count]=$phpcolor->assignment();
      for ($count1=0;$count1<count($posttj[$count]);$count1++)
      {
        echo "<a href='read.php?id=".$posttj[$count][$count1]['yid']."'>".$posttj[$count][$count1]['theme']."</a><br>";
      }
    }
	?> 
	</td>
  </tr>
  <tr>
    <td bgcolor="#EDF8FC" style="font-size:14px;"><?php echo $core_bartype; ?>目录</td>
  </tr>
  <tr>
    <td>
	  <?php
      $phpcolor->table="class";
      $phpcolor->field="id,classname,base";
      $phpcolor->where="belong = 0 order by queue";
      $bigsort=$phpcolor->assignment();
      for ($count=0;$count<count($bigsort);$count++)
      {
	    echo "[<a href='class.php?id=".$bigsort[$count]['id']."'>".$bigsort[$count]['classname']."</a>]&nbsp;&nbsp;";
        if($bigsort[$count]['base']=="0")
        {
          $phpcolor->table="class";
          $phpcolor->field="id,classname";
          $phpcolor->where="belong = ".$bigsort[$count]['id']." order by queue limit 3";
          $smallsort[$count]=$phpcolor->assignment();
		  for ($count1=0;$count1<count($smallsort[$count]);$count1++)
          {
		    echo "<a href='class.php?id=".$smallsort[$count][$count1]['id']."'>".$smallsort[$count][$count1]['classname']."</a>&nbsp;&nbsp;";
		  }
        }
        else
        {
          $phpcolor->table="bar";
          $phpcolor->field="id,barname";
          $phpcolor->where="barclass = ".$bigsort[$count]['id']." order by id desc limit 3";
          $smallsort[$count]=$phpcolor->assignment();
		  for ($count1=0;$count1<count($smallsort[$count]);$count1++)
          {
		    echo "<a href='list.php?bid=".$smallsort[$count][$count1]['id']."'>".$smallsort[$count][$count1]['barname']."</a>&nbsp;&nbsp;";
		  }
        }
		echo "<a href='class.php?id=".$bigsort[$count]['id']."'>更多</a><br>";
      }
	  ?>
	</td>
  </tr>
  <tr>
    <td bgcolor="#EDF8FC" style="font-size:14px;">友情链接</td>
  </tr>
  <tr>
    <td>
	  <?php
      $phpcolor->table="link";
      $phpcolor->field="name,link";
      $phpcolor->where="type != 0 order by type, queue";
      $link=$phpcolor->assignment();
      for ($count=0;$count<count($link);$count++)
      {
	    echo "<a href='".$link[$count]['link']."'>".$link[$count]['name']."</a>&nbsp;&nbsp;";
      }
	  ?>
	</td>
  </tr>
  <tr><td>Copyright 2010-2014 phpcolor.com 版权所有 <?php echo $core_wflow; ?></td></tr>
</table>
</body>
</html>