<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[9]!=1)
  jump("jump.php?id=25&jump=main.php");
$phpcolor->table="bar";
$phpcolor->where="id = '".$_GET['id']."'";
if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "yes")
{
  $phpcolor->field="state='1'";
  $phpcolor->upgrade();
  jump("jump.php?id=24&jump=baraudit.php");
}
if(isset($_GET['action']) and isset($_GET['id']) and $_GET['action'] == "no")
{
  $phpcolor->table="bar";
  $phpcolor->where="id = '".$_GET['id']."'";
  $phpcolor->delete();
  $phpcolor->table="bar_user";
  $phpcolor->where="bid = '".$_GET['id']."'";
  $phpcolor->delete();
  $phpcolor->table="topic";
  $phpcolor->field="id";
  $phpcolor->where="belong = '".$_GET['id']."'";
  $rs = $phpcolor->assignment();
  $phpcolor->delete();
  $phpcolor->table="repost";
  for($count=0;$count<count($rs);$count++)
  {
    $phpcolor->where="belong = '".$rs[$count]['id']."'";
    $phpcolor->delete();
  }
  jump("jump.php?id=24&jump=baraudit.php");
}
if(!isset($_GET['page']))
  $_GET['page']=0;
$phpcolor->field="*";
$phpcolor->where="state = '2'";
$count = $phpcolor->exist(2);
$phpcolor->field="id,barname,introduction,barclass,ausername";
$phpcolor->where="state = '2' limit ".($_GET['page']*20).",20";
$bar=$phpcolor->assignment();
for($count=0;$count<count($bar);$count++)
{
  if($bar[$count]['barclass']!=0)
  {
    $phpcolor->table="class";
    $phpcolor->field="classname";
    $phpcolor->where="id = '".$bar[$count]['barclass']."'";
    $rs=$phpcolor->exist(1);
    $bar[$count]['barclass'] = $rs['classname'];
  }
  else
    $bar[$count]['barclass'] = "ÔÝÎÞ";
}
$page=pages($count,20,$_GET['page'],'baraudit','','','0');
$tpl -> assign("bar", $bar);
$tpl -> assign("page", $page);
$tpl -> display("baraudit.htm");
?>