<?php
include("require.php");
echo "<wml><card title='多彩贴吧'>\n";
echo "<p>\n";
echo "<img src='logo.gif'/>";
echo "</p>\n";
echo "<p>\n";
echo "<a href='index.php'>首页</a> ";
if(isset($_COOKIE["core_user_name"]))
  echo $_COOKIE["core_user_name"]." <a href='post.php?action=quit'>退出</a>";
else
  echo "<a href='user.php'>登录</a>";
echo " <a href='class.php'>分类</a>";
echo "</p>\n";
echo "<p>\n";
echo "<input name='barname' value=''/>\n";
echo "<anchor>进入贴吧";
echo "<go href='post.php' method='post' accept-charset='utf-8'>";
echo "<postfield name='action' value='gobar'/>";
echo "<postfield id='barname' name='barname' value='$(barname)'/>";
echo "</go>";
echo "</anchor>";
echo "</p>\n";
echo "<p>\n";
$phpcolor->table=$core_mysql_prefix."bar";
$phpcolor->field="id,barname";
$phpcolor->where="recommend = 1 order by rand() limit 8";
$bar=$phpcolor->assignment();
if(count($bar))
  echo "贴吧推荐：";
for ($count=0;$count<count($bar);$count++)
{ 
  echo " <a href='list.php?bid=".$bar[$count]['id']."'>".$bar[$count]['barname']."</a>";
} 
echo "</p>\n";
$phpcolor->table=$core_mysql_prefix."topic";
$phpcolor->field="id,theme";
$phpcolor->where="recommend = 2 order by rand() limit 2";
$headlines=$phpcolor->assignment();
for ($count=0;$count<count($headlines);$count++)
{ 
  $headlines[$count]['theme']=$phpcolor->mysubstr($headlines[$count]['theme'],0,50); 
  echo "<p>\n";
  echo "<a href='read.php?id=".$headlines[$count]['id']."'>[头条推荐]".$headlines[$count]['theme']."</a>\n";
  echo "</p>\n";
}
$phpcolor->table=$core_mysql_prefix."topic";
$phpcolor->field="id,theme";
$phpcolor->where="recommend = 1 order by rand() limit 10";
$post=$phpcolor->assignment();
for ($count=0;$count<count($post);$count++)
{ 
  $post[$count]['theme']=$phpcolor->mysubstr($post[$count]['theme'],0,50); 
  echo "<p>\n";
  echo "<a href='read.php?id=".$post[$count]['id']."'>[热点关注]".$post[$count]['theme']."</a>\n";
  echo "</p>\n";
} 
echo "</card></wml>";
?>