From 949d452274e6a5fb0d151968b81f149d70c084bf Mon Sep 17 00:00:00 2001 From: tianya Date: Wed, 9 Sep 2020 19:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E9=87=87=E7=94=A8IP=E9=99=90=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/arc.searchview.class.php | 44 +++++++++++++++------------- src/plus/search.php | 24 ++++++++------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/include/arc.searchview.class.php b/src/include/arc.searchview.class.php index 631ab255..3485dfa3 100755 --- a/src/include/arc.searchview.class.php +++ b/src/include/arc.searchview.class.php @@ -1,4 +1,4 @@ -TotalResult / $this->PageSize); if($totalpage<=1 && $this->TotalResult>0) { - return "共1页/".$this->TotalResult."条记录"; + return ""; } if($this->TotalResult == 0) { - return "共0页/".$this->TotalResult."条记录"; + return ""; } $purl = $this->GetCurUrl(); @@ -838,7 +838,7 @@ class SearchView { $totalpage = ceil($this->SearchMaxRc/$this->PageSize); } - $infos = "共找到".$this->TotalResult."条记录/最大显示{$totalpage}页 \r\n"; + $infos = "
  • 共找到".$this->TotalResult."条记录/最大显示{$totalpage}
  • \r\n"; $geturl = "keyword=".urlencode($oldkeyword)."&searchtype=".$this->SearchType; $hidenform = "\r\n"; $geturl .= "&channeltype=".$this->ChannelType."&orderby=".$this->OrderBy; @@ -855,21 +855,21 @@ class SearchView //获得上一页和下一页的链接 if($this->PageNo != 1) { - $prepage.="上一页\r\n"; - $indexpage="首页\r\n"; + $prepage.="
  • 上一页
  • \r\n"; + $indexpage="
  • 首页
  • \r\n"; } else { - $indexpage="首页\r\n"; + $indexpage="
  • 首页
  • \r\n"; } if($this->PageNo!=$totalpage && $totalpage>1) { - $nextpage.="下一页\r\n"; - $endpage="末页\r\n"; + $nextpage.="
  • 下一页
  • \r\n"; + $endpage="
  • 末页
  • \r\n"; } else { - $endpage="末页\r\n"; + $endpage="
  • 末页
  • \r\n"; } //获得数字链接 @@ -896,28 +896,30 @@ class SearchView { if($j == $this->PageNo) { - $listdd.= "$j \r\n"; + $listdd.= "
  • $j 
  • \r\n"; } else { - $listdd.="[".$j."] \r\n"; + $listdd.="
  • ".$j." 
  • \r\n"; } } - $plist = "\r\n"; - $plist .= "\r\n"; + $plist = ""; + // $plist = "
    \r\n"; + // $plist .= "\r\n"; $plist .= "$hidenform"; + $plist .= "\r\n"; - $plist.="\r\n"; - } - $plist .= "\r\n\r\n
    \r\n"; + // if($totalpage>$total_list) + // { + // $plist.="\r\n"; + // $plist.="\r\n"; + // } + $plist .= "\r\n"; return $plist; } diff --git a/src/plus/search.php b/src/plus/search.php index 8f8205bb..75307114 100755 --- a/src/plus/search.php +++ b/src/plus/search.php @@ -84,12 +84,20 @@ if(($keyword=='' || strlen($keyword)<2) && empty($typeid)) } //检查搜索间隔时间 -$lockfile = DEDEDATA.'/time.lock.inc'; -$lasttime = file_get_contents($lockfile); -if(!empty($lasttime) && ($lasttime + $cfg_search_time) > time()) -{ - ShowMsg('管理员设定搜索时间间隔为'.$cfg_search_time.'秒,请稍后再试!','-1'); - exit(); + +$ip = GetIP(); +$now = time(); + +$row = $dsql->GetOne("SELECT * FROM `#@__search_limits` WHERE ip='{$ip}'"); + +if (is_array($row)) { + if (($now - $row['searchtime']) < $cfg_search_time) { + ShowMsg('管理员设定搜索时间间隔为'.$cfg_search_time.'秒,请稍后再试!','-1'); + exit; + } + $dsql->ExecuteNoneQuery("UPDATE `#@__search_limits` SET `searchtime`='{$now}' WHERE `ip`='{$ip}';"); +} else { + $dsql->ExecuteNoneQuery("INSERT INTO `#@__search_limits` (`ip`, `searchtime`) VALUES ('{$ip}', '{$now}');"); } //开始时间 @@ -109,8 +117,4 @@ $t1 = ExecTime(); $sp = new SearchView($typeid,$keyword,$orderby,$channeltype,$searchtype,$starttime,$pagesize,$kwtype,$mid); $keyword = $oldkeyword; $sp->Display(); - - -PutFile($lockfile, time()); - //echo ExecTime() - $t1; \ No newline at end of file