<?php 
	$gro = $_GET['cid'];
	if($gro == NULL)
	{
		$gro = 0;
	}
    $result = mysql_query("SELECT cid,cn,url,xuhao,q,siteid,gro,list FROM class WHERE siteid='{$wapid}' AND gro='{$gro}' ORDER BY xuhao");
	if($result && mysql_num_rows($result)>0){
	$i = 0; 
		while(list($cid,$cn,$url,$xuhao,$q,$siteid,$gro,$list) = mysql_fetch_row($result))
		{	
			if($list == '1'){
			$classlist .= $q;
			}else{
			$classlist .=  $q.'<a href="index.php?cid='.$cid.'">'.$cn.'</a>';
			}
			
		}
		$class_list = 1;
	}else{
		$class_list = 0;
	}
	if($_GET['cid'] == 0||$_GET['cid'] == NULL){
		$sitetitle   =   user('stitle','id',WAPID);
		$wapTop      =   $cfginfo['index_top'];
		$wapBottom   =   $cfginfo['index_bottom'];
		}else{
		$classinfo = lm_info($_GET['cid']);
			if(get_mkurl($classinfo['url']) !='NULL' && $class_list==0)
			{
				header("location:".get_mkurl($classinfo['url'])."?".$_SERVER['QUERY_STRING']);
				die();
			}
			$sitetitle   =   $classinfo['cn'];
			$wapTop  	 =   $classinfo['top'];
			$wapBottom   =   $classinfo['bottom'];
	}

$html .= head($sitetitle);
$html .= $wapTop.$classlist.$wapBottom;
$html .= footer(0);