require('include/common.inc.php'); require('include/ipLocation.class.php'); $myobj=new ipLocation(); if(trim($_POST['content'])){ $_POST['content']=strip_tags($_POST['content']); $_POST['content']=str_replace("\r"," ",$_POST['content']); $_POST['content']=str_replace("\n"," ",$_POST['content']); $q=$db->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='