SetQuery("Select id,typename,channeltype From `#@__arctype`"); $dsql->Execute(); while($row = $dsql->GetArray()) { fwrite($fp, "\$typeArr[{$row['id']}] = '{$row['typename']}';\r\n"); } fwrite($fp, '?'.'>'); fclose($fp); } //引入欄目緩存并看關鍵字是否有相關欄目內容 require_once($typenameCacheFile); if(isset($typeArr) && is_array($typeArr)) { foreach($typeArr as $id=>$typename) { //$keywordn = str_replace($typename, ' ', $keyword); $keywordn = $keyword; if($keyword != $keywordn) { $keyword = HtmlReplace($keywordn); $typeid = intval($id); break; } } } } $keyword = addslashes(cn_substr($keyword,30)); $typeid = intval($typeid); if($cfg_notallowstr !='' && preg_match("#".$cfg_notallowstr."#i", $keyword)) { ShowMsg("你的搜索關鍵字中存在非法內容,被系統禁止!","-1"); exit(); } if(($keyword=='' || strlen($keyword)<2) && empty($typeid)) { ShowMsg('關鍵字不能小于2個字節!','-1'); exit(); } //檢查搜索間隔時間 $lockfile = DEDEDATA.'/time.lock.inc'; $lasttime = file_get_contents($lockfile); if(!empty($lasttime) && ($lasttime + $cfg_search_time) > time()) { ShowMsg('管理員設定搜索時間間隔為'.$cfg_search_time.'秒,請稍后再試!','-1'); exit(); } //開始時間 if(empty($starttime)) $starttime = -1; else { $starttime = (is_numeric($starttime) ? $starttime : -1); if($starttime>0) { $dayst = GetMkTime("2008-1-2 0:0:0") - GetMkTime("2008-1-1 0:0:0"); $starttime = time() - ($starttime * $dayst); } } $t1 = ExecTime(); $sp = new SearchView($typeid,$keyword,$orderby,$channeltype,$searchtype,$starttime,$pagesize,$kwtype,$mid); $keyword = $oldkeyword; $sp->Display(); PutFile($lockfile, time()); //echo ExecTime() - $t1;意甲二十年二十人