query("insert into spe_liuyan(id,catid,content,date,ip) values('','".$_POST['catid']."','".$_POST['content']."','".date("Y-m-j H:i:s")."','".$_SERVER['REMOTE_ADDR']."')"); echo 'ok'; } if($_GET['action']=='num' && is_numeric($catid)){ $num=$db->get_one("select count(*) as num from spe_liuyan where catid=$catid"); echo 'document.write("'.$num[num].'");'; } $page=trim($_POST['page']); $catid=trim($_POST['catid']); $pagesize=4; $total=$db->get_one("select count(*) as num from spe_liuyan where catid=$catid"); $total=$total[num]; $pagenum=ceil($total/$pagesize); $page=($page=='' || $page<1)?1:intval($page); $pre=($page==1)?1:($page-1); $next=($page==$pagenum)?$pagenum:($page+1); $ofset=($page-1)*$pagesize; if($_GET['action']=='list' && is_numeric($catid)){ $is_sh = " and shenhe='1'"; if($catid == '2352') $is_sh = ""; $is_sh = ""; if($anum == '') $anum = 4; //$infos=$db->select("select * from spe_liuyan where catid=$catid $is_sh order by id desc limit $anum"); $infos=$db->select("select * from spe_liuyan where catid=$catid order by id desc limit $ofset,$pagesize"); $num=count($infos); $html='
'; for($i=0;$i<$num;$i++){ $address=$myobj->getaddress($infos[$i]['ip']); $html.='
'.iconv("GB2312","utf-8",$address["area1"]).''.iconv("GB2312","utf-8",$address["area2"]).'IP:'.preg_replace("/^([0-9]+\.[0-9]+\.).+$/","\\1",$infos[$i]['ip']).'*.'.'*'.''.$infos[$i][date].'发布
'.str_cut($infos[$i][content],120,"...").'
'; } $html.='
'; $html.='