'".$keyboard."'"; } elseif($hh=='EQ')//等于 { $where=$f."='".$keyboard."'"; } elseif($hh=='LE')//小于等于 { $where=$f."<='".$keyboard."'"; } elseif($hh=='GE')//大于等于 { $where=$f.">='".$keyboard."'"; } elseif($hh=='NE')//不等于 { $where=$f."<>'".$keyboard."'"; } elseif($hh=='IN')//包含 { $kr=explode(' ',$keyboard); $kcount=count($kr); $kbs=''; $dh=''; for($i=0;$i<$kcount;$i++) { if(empty($kr[$i])) { continue; } if($kbs) { $dh=','; } $kbs.=$dh."'".$kr[$i]."'"; } if($kbs) { $where=$f." IN (".$kbs.")"; } else { return ''; } } elseif($hh=='BT')//范围 { $keyboard=ltrim($keyboard); if(!strstr($keyboard,' ')) { return ''; } $kr=explode(' ',$keyboard); if(!trim($kr[0])||!trim($kr[1])) { return ''; } $where=$f." BETWEEN '".$kr[0]."' and '".$kr[1]."'"; } else//相似 { $where=$f." LIKE '%".str_replace(" ","%",$keyboard)."%'"; } } else { $where=$f." LIKE '%".str_replace(" ","%",$keyboard)."%'"; } return $where; } //变量 if($_GET['searchget']==1) { $_POST=$_GET; } //搜索栏目及表 $classid=RepPostVar($_POST['classid']); //$s_tbname=RepPostVar($_POST['tbname']); $s_tbname="news"; //$s_tempid=(int)$_POST['tempid']; $trueclassid=0; $add=""; if($classid)//按栏目 { $trueclassid=intval($classid); $add=" and classid='$trueclassid'"; } //表不存在 $tbnamenum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewstable where tbname='$s_tbname' limit 1"); if(!$tbnamenum) { exit("[err]news table is not exist[/err]"); } $tbname=$s_tbname; //关键字 $keyboard=$_POST['keyboard']; $keyboard=trim($keyboard); if(empty($keyboard)) { exit("[err]no subject[err]"); } //字段 $searchclass="title"; $allwhere=$searchclass."='".$keyboard."' ".$add; $query="select count(*) as total from {$dbtbpre}ecms_".$tbname." where ".$allwhere; $search_num=$empire->gettotal($query); if(empty($search_num)) { echo("[no]"); } else { echo("[yes]"); } db_close(); $empire=null; ?>