<?php
session_start();
if ($_SESSION['login']!="ok") {
	echo "<script language='javascript'>";
	echo " location='./';";
	echo "</script>";
}
?>
<?php
require("config.php");
require("conn.php");
require("function.php");
$k=$_GET['k'];
 $req1=mysql_query("select count(id) as count from kind");
 $return1=mysql_fetch_array($req1);
 $count=$return1['count'];
 $req=mysql_query("select * from kind order by id DESC");
 $i=0;
echo "{total:$count,results:[";
if($k=="count"){
   while($return=mysql_fetch_array($req)){
	$name=$return['name'];
	$id=$return['id'];
	$name=$name."(".count_kind_web($id).")";
	echo "{name:'$name',value:'$id'}";
	$i++;
	if($i<$count){echo ",";}
  }	
}else{
  while($return=mysql_fetch_array($req)){
	$name=$return['name'];
	$id=$return['id'];	
	echo "{name:'$name',value:'$id'}";
	$i++;
	if($i<$count){echo ",";}
  }	
}

echo "]}";
 
?>
