<%@ codepage ="936" %>
  <% 
	data_path="../" 'ACC连接数据库路径，对SQL无效
	numid="04"
	dir="err.asp" 
  %>
  <!--#include file="../conn/conn.asp" -->
<!--#include file="../inc/safe.asp"-->
  <!--#include file="rolecheckout.asp"-->
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站热门关键字</title>
<LINK href="css/style.css" rel=stylesheet type=text/css>

<script language="javascript">
function isok()
{
var i=confirm("你确定要删除吗?");
if(i)
{
return true;
}
else
{
return false;
}
}
function modicheck()
 {
 var str=document.modiform.keyword.value;
 if(str.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入关键字!");
 document.modiform.keyword.focus();
 return false;
 }
 var str2=document.modiform.hits.value;
 if(str2.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入搜索的次数！");
 document.modiform.hits.focus();
 return false;
 }
 }
function addcheck()
 {
 var str=document.addform.addkeyword.value;
 if(str.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入关键字!");
 document.addform.addkeyword.focus();
 return false;
 }
 var str2=document.addform.addhits.value;
 if(str2.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入搜索的次数！");
 document.addform.addhits.focus();
 return false;
 }
 }
</script>
</HEAD>
<%
'执行删除操作^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
action=Replace_Text(Request("action"))
id=Replace_Text(Request("id"))
keyn=Replace_Text(Request("keyn"))
modibtn=Replace_Text(Request("modibtn"))
keyword=Replace_Text(Request("keyword"))
filekey=Replace_Text(Request("filekey"))
hits=Replace_Text(Request("hits"))
hittimes=Replace_Text(Request("hittimes"))
filek=Replace_Text(Request("filek"))
if action="del" then
conn.execute "delete from Websen_keyhots where id="&id 
response.Redirect(request.ServerVariables("HTTP_REFERER"))
end if
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

'修改处理^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if modibtn<>"" then
if keyword="" then 
response.Write("<script>alert('请输入关键字!');history.back(-1);</script>")
response.End()
end if
 if hits="" then
 response.Write("<script>alert('请输入该关键字的搜索次数!');history.back(-1);</script>")
response.End()
end if
if not isnumeric(hits) then
response.Write("<script>alert('请输入数字!');history.back(-1);</script>")
response.End()
end if

conn.execute "update Websen_keyhots set keywords='"&keyword&"',filekey='"&filekey&"',hits="&hits&" where id="&id
end if


'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

'添加处理^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addkeyword=Replace_Text(Request("addkeyword"))
addfilekey=Replace_Text(Request("addfilekey"))
addhits=Replace_Text(Request("addhits"))
addbtn=Replace_Text(Request("addbtn"))
if addbtn<>"" then
if addkeyword="" then
response.Write("<script>alert('请输入关键字!');history.back(-1);</script>")
response.End()
end if
if addhits="" then
response.Write("<script>alert('请输入搜索的次数!');history.back(-1);</script>")
response.End()
end if
if not isnumeric(addhits) then
response.Write("<script>alert('请输入数字!');history.back(-1);</script>")
response.End()
end if
set rsha=server.CreateObject("ADODB.recordset")
sqlha="select * from Websen_keyhots where keywords='"&addkeyword&"'"
rsha.open sqlha,conn,1,3
if not rsha.eof then
 response.Write("<script>alert('该关键字已经存在!');history.back(-1);</script>")
response.End()
 end if
if rsha.eof then
rsha.addnew
rsha("keywords")=addkeyword
rsha("filekey")=addfilekey
rsha("hits")=addhits
rsha("startdate")=date()
rsha.update
end if
end if

'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%>
<body>
<table width="100%" border="0"  align=center cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
  <tr>
    <td width="100%" height=30 align="center" bgcolor="#FFFFFF" class="tableHeaderText"><strong> 网站热门关键字管理 </strong></td>
  </tr>
  <tr>
    <td   height="20" bgcolor="#E4EDF9" class="indhot"><strong>注意</strong>：<br>
      ① 网站热门关键字是用于网站内快速搜索用途;<br> 
      ② 该动态关键字是可由管理员后台添加和根据前台的搜索频率来由系统自动添加，其调用可由【<A onClick="javascript:window.open('labelwrite.asp','','toolbar=no,directories=no,scrollbars=yes,resizable=1,status=no,menubar=no');" href="#">自定义标签辅助工具</A>】产生标签放入系统模板中生效！<BR>
    <a href="hotkeywords.asp?action=add"><strong><font color="red">添加关键字</font></strong></a>    </td>
  </tr>
</table>
 <%
if action="add" then
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style=" margin-top: 10px">
<form action="hotkeywords.asp"  method="post" name="addform"  onSubmit="return addcheck();">
<tr><td bgcolor="#E4EDF9">添加关键字：关键字
<input  name="addkeyword"  type="text"  onblur="this.value=this.value.replace(/\s/igm,'')"  value="" size="25"  maxlength="10">
&nbsp;处理页面<select size="1" name="addfilekey" >
<option value="exp_search.asp">展会搜索</option>
<option value="News_search.asp">行业资讯搜索</option>
<option value="searchall.asp">供求搜索</option>
<option value="searchbuy.asp">求购搜索</option>
<option value="searchCom.asp">公司库搜索</option>
<option value="searchhelp.asp">帮助搜索</option>
<option value="searchproduct.asp">产品库搜索</option>
<option value="searchsale.asp">供应搜索</option>
<option value="searchvipinfo.asp">专项商机搜索</option>
 </select>
 <input name="addhits" type="text"  onblur="this.value=this.value.replace(/\s/igm,'')"  value="" size="15" maxlength="8">
<input type="submit"  name="addbtn" value="添加" style="background-color:#EEEEEE">
 </td>
</tr>
</form>
</table>
<%
end if
if action="modi" then
%>
<table width="100%" border="0"  align="center" cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style=" margin-top: 10px">
<form name="modiform" method="post" action="hotkeywords.asp"  onSubmit="return modicheck();"><tr><td  height="25" bgcolor="#E4EDF9">
<input type="hidden" name="id" value="<%=id%>" >
搜索关键字修改： 关键字<input name="keyword"  type="text" onBlur="this.value=this.value.replace(/\s/igm,'')" value="<%=keyn%>" size="25" maxlength="10">
&nbsp;处理页面
<select size="1" name="filekey" >
<option value="exp_search.asp" <%if filek="exp_search.asp" then response.Write("selected") end if%>>展会搜索</option>
<option value="News_search.asp" <%if filek="News_search.asp" then response.Write("selected") end if%>>行业资讯搜索</option>
<option value="searchall.asp" <%if filek="searchall.asp" then response.Write("selected") end if%>>供求搜索</option>
<option value="searchbuy.asp" <%if filek="searchbuy.asp" then response.Write("selected") end if%>>求购搜索</option>
<option value="searchcom.asp" <%if filek="searchcom.asp" then response.Write("selected") end if%>>公司库搜索</option>
<option value="searchhelp.asp" <%if filek="searchhelp.asp" then response.Write("selected") end if%>>帮助搜索</option>
<option value="searchproduct.asp" <%if filek="searchproduct.asp" then response.Write("selected") end if%>>产品库搜索</option>
<option value="searchsale.asp" <%if filek="searchsale.asp" then response.Write("selected") end if%>>供应搜索</option>
<option value="searchvipinfo.asp" <%if filek="searchvipinfo.asp" then response.Write("selected") end if%>>专项商机搜索</option>
 </select>
 <input name="hits" type="text"  onblur="this.value=this.value.replace(/\s/igm,'')"  value="<%=hittimes%>" size="15" maxlength="8">
<input type="submit"  name="modibtn" value="修改" style="background-color:#EEEEEE"> 
</td>
</tr></form></table>
<%
 end if
 %>
<table width="100%"  border="0" align="center"   cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#C4D8ED" style=" margin-top: 10px">
  <tr>
    <td height="30" bgcolor="#FFFFFF">&nbsp;<strong>关键字</strong></td>
    <td bgcolor="#FFFFFF"><strong>处理搜索的页面</strong></td>
    <td bgcolor="#FFFFFF"><strong>关键字</strong></td>
    <td bgcolor="#FFFFFF"><strong>处理搜索的页面</strong></td>
  </tr>
  <tr >
    <%
set rs=server.CreateObject("adodb.recordset")
sql="select * from Websen_keyhots order by  hits desc"
rs.open sql,conn,1,1
 msg_per_page=40                   '定义每页显示记录条数
 	rs.Pagesize=msg_per_page '定义分页记录集每页显示记录数
 	If Not (rs.Eof And rs.Bof) Then
		totalrec=rs.RecordCount'总记录条数
		If rs.Recordcount Mod msg_per_page=0 Then'计算总页数,recordcount:数据的总记录数
			n=rs.Recordcount\msg_per_page'n:总页数
		Else
			n=rs.Recordcount\msg_per_page+1                        
		End If                                                                
		currentpage=Request("page")'currentpage:当前页
		If currentpage <> "" Then
			currentpage = Cint(currentpage)
			If currentpage < 1 Then  
				currentpage = 1
			End If  
			If Err.Number <> 0 Then '错误处理
				Err.Clear
				currentpage=1
			End If
		Else
			currentpage=1
		End If                                                                
		If currentpage*msg_per_page > totalrec And Not((currentpage-1)*msg_per_page < totalrec) Then 
			currentPage=1
		End If
		rs.Absolutepage=currentpage'absolutepage：设置指针指向某页开头
		rowcount=rs.Pagesize'pagesize：设置每一页的数据记录数
	End If
if not rs.eof then 

hoti=1
do while not rs.eof  And rowcount > 0
 %>
    <td  height="25" bgcolor="#E4EDF9"><%=hoti%>.<%=rs("keywords")%> (搜索率<font color="red"><%=rs("hits")%></font>)</td>
    <td bgcolor="#E4EDF9">〖处理页:<%=rs("filekey")%>〗<br>
    「<a href="hotkeywords.asp?action=modi&id=<%=rs("id")%>&keyn=<%=rs("keywords")%>&hittimes=<%=rs("hits")%>&filek=<%=rs("filekey")%>"><font color="red">修改</font></a>」「<a href="hotkeywords.asp?action=del&id=<%=rs("id")%>" onClick="return isok();"><font color="red">删除</font></a>」</td>
    <%
if hoti mod 2=0 then
response.Write("</tr><tr>")
end if
hoti=hoti+1
 rowcount=rowcount-1
 rs.movenext
loop
 end if
 %>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#FFFFFF"><%=listPages("hotkeywords.asp")%></td>
  </tr>
</table>
<blockquote>&nbsp;</blockquote>
</body>
</html>
<%
rs.close
conn.close
%>