 <?php 
 function postReply($userid,$siteid,$mkinfo,$gro,$text){
	    if($l==''||$l==NULL){
		    $l='100000';
			}
	    $time = time();
	    $sql  = "INSERT INTO reply(userid,siteid,mkinfo,gro,content,time)VALUE 
		('{$userid}','{$siteid}','{$mkinfo}','{$gro}','{$text}','{$time}')";
	    $reply = mysql_query($sql);
        if($reply && mysql_affected_rows()>0){
	    $html = 1;
	    }else{
	    $html = 0;
	        }
			//$text = mb_substr($html,0,$l,"UTF-8");
			return $html;
	    }
function listReply($gro,$type){
	$wapid = WAPID;
	$sql = "SELECT * FROM `reply` WHERE siteid='{$wapid}' AND gro='{$gro}' AND mkinfo='{$type}' ORDER BY reid DESC LIMIT 10";
	$reply = mysql_query($sql);
	if($reply && mysql_num_rows($reply)>0){
	    while(list($reid,$userid,$mkinfo,$gro,$siteid,$content,$time)= mysql_fetch_row($reply))
		{
		$return .= '<div class="commLine"><a href="http://'.HTTP_HOST.'/user/userinfo.php?toid='.user('xid','id',$userid).'">'.user('nc','id',$userid).'</a>'.date("Y-m-d H:i",$time).'<br><content>'.$content.'</content></div>'; 
		}
		if( mysql_num_rows($reply) > 10)
		{
	    $return = $return.'<div class="more"><a href="reply_list.php?id='.$_GET['id'].'">查看更多评论('. mysql_num_rows($reply).')</a></div>';
		}
	}else{
	$return = '暂时没有评论';
	}
	return $return;
}
function listReplyAll($gro,$type,$start,$limit){
	$wapid = WAPID;
	$sql = "SELECT * FROM `reply` WHERE siteid='{$wapid}' AND gro='{$gro}' AND mkinfo='{$type}' ORDER BY reid DESC LIMIT {$start},{$limit}";
	$reply = mysql_query($sql);
	if($reply && mysql_num_rows($reply)>0){
	$num = 0;
	               while(list($reid,$userid,$mkinfo,$gro,$siteid,$content,$time)= mysql_fetch_row($reply)){
				   $div = $num++%2 == 0?'line1':'line2';
					$return .= '<div class="'.$div.'"><a href="http://'.HTTP_HOST.'/user/userinfo.php?toid='.user('xid','id',$userid).'">'.user('nc','id',$userid).'</a>'.date("Y-m-d H:i",$time).'<br><content>'.$content.'</content></div>'; 
				   }
				   /*if( mysql_num_rows($reply) > 10){
				   $return = $return.'<div class="more"><a href="reply_list.php?id='.$_GET['id'].'">查看更多评论('. mysql_num_rows($reply).')</a></div>';
				   }*/
				}else{
					$return = '暂时没有评论';
				}
		return $return;
}
function listReplyNums($gro,$type){
	$wapid = WAPID;
	$sql = "SELECT * FROM `reply` WHERE siteid='{$wapid}' AND gro='{$gro}' AND mkinfo='{$type}'";
	$reply = mysql_query($sql);
	if($reply && mysql_num_rows($reply)>0){
		return mysql_num_rows($reply);
	}else{
		return '0';
	}
}