⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admsearch.asp

📁 商务网站,信息分类,可以搜索加上ACCESS数据库
💻 ASP
字号:
<%Option Explicit%>
<%
'*************************************************************************************
'            write by Lanmang Studio 惠惠龙
'            2001.1 release it
'            Homepage: http://www.hhlong.com/network
'            E_mail:longweb@cmmail.com
'*************************************************************************************
%>
<%
dim objRS,sql
dim keyword		'查询关键字
dim op			'逻辑操作——与?或?
dim si			'查找网站?类目?
dim lang		'网站语言
dim sortid		'在ID号为sortid的类下查询
dim wanwei		'查询范围——网址、网站标题、网站说明、提交人
dim ispass		'是否为已通过验证的网站

dim i,getpidsql,objRS_getpid,pidlist,tmp
dim keywordlist,likelist
dim pagecount,currpage,Spage,Epage,recordcount,Query_String

keyword		= Request.QueryString("keyword")
op			= Request.QueryString("op")
si			= Request.QueryString("si")
lang		= UCase(Request.QueryString("lang"))
sortid		= Request.QueryString("sortid")
wanwei		= Request.QueryString("wanwei")
ispass		= Request.QueryString("ispass")

keyword = replace(keyword,"'","")		'过滤关键字
keyword = replace(keyword,"[","")
keyword = trim(keyword)

if Trim(keyword) = "" then
	Response.Write("<center><font color=red>请输入关键字!</font><br>欢迎使用黄金联盟搜索引擎。</center>")
	Response.End
end if
if Trim(wanwei) = "" and Trim(si) = "STA" then
	Response.Write("<center><font color=red>请定义查询范围!</font><br>欢迎使用黄金联盟搜索引擎。</center>")
	Response.End
end if

currpage = request.querystring("page")
if currpage = "" or IsNull(currpage) then currpage = 1
if not IsNumeric(currpage) then currpage = 1
currpage = Cint(currpage)
Query_String = request.ServerVariables("QUERY_STRING")
%>
<!--#include file="CONFIG.ASP"-->
<!--#include file="adoconn.asp"-->
<%
keywordlist = split(keyword,chr(32))		'按空格分割关键字
if UCase(op) = "OR" then
	op = "OR"
else
	op = "AND"
end if
if UCase(si) = "SORT" then
	likelist = mklikelist("sortname",keywordlist,op)
	sql = "select * from sort where " & likelist
else
	if trim(wanwei) = "" then wanwei = "stationurl,stationname,description,whopost"
	wanwei = split(wanwei,chr(44))
	likelist = ""
	for i = 0 to UBound(keywordlist)
		likelist = likelist & " " & op & " " & mklikelist2(wanwei,keywordlist(i),"or")
	next
	likelist = right(likelist,len(likelist) - len(" " & op & " "))
	sql = "select * from stationinfo where " & likelist
	if trim(lang) <> "" and lang <> "ALL" then
		sql = sql & " and stationlang = '" & lang & "'"
	end if
	if trim(sortid) <> "" and IsNumeric(sortid) and sortid <> -1 and sortid <> "-1" then
    	getpidsql = "select * from pathform where (thispath = '" & sortid & "') or (thispath like '%" & chr(44) & sortid & chr(44) & "%') or (thispath like '%" & chr(44) & sortid & "') or (thispath like '" & sortid & chr(44) & "%')"
'Response.Write("getpidsql: " & getpidsql & "<br>")
        Set objRS_getpid = objConn.Execute(getpidsql)
    	pidlist = ""
	    do while not objRS_getpid.EOF
	        tmp = objRS_getpid("thispath")
	        pidlist = pidlist & chr(44) & getEndID(tmp)
	        objRS_getpid.MoveNext()
	    loop
'Response.Write("pidlist: " & pidlist & "<br>")
	    if pidlist <> "" then
	        pidlist = "(" & right(pidlist,len(pidlist) - 1) & ")"
		    sql = sql & " and parentid in " & pidlist
        end if
	end if
	if UCase(ispass) = "FALSE" then
	    ispass = "FALSE"
	    sql = sql & " and ispass = FALSE order by parentid"
	else
	    ispass = "TRUE"
	    sql = sql & " and ispass = TRUE order by parentid"
    end if

end if

'Response.Write("sql: " & sql & "<br>")
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open sql, objConn, 3, 1

recordcount = objRS.RecordCount
objRS.PageSize = PAGESIZE
pagecount = objRS.PageCount
if currpage < 1 then
    currpage = 1
elseif currpage > pagecount then
    currpage = pagecount
end if
%>


<%
'//////////////////////////////////////////////// 输出查询结果 //////////////////////////////////////
dim objRS_path,pid,ischg,j
dim p

Response.Write("<HTML>" & VbCrlf)
Response.Write("<HEAD>" & VbCrlf)
Response.Write("<meta HTTP-EQUIV=""Content-Type"" CONTENT=""text/html; charset=gb2312"">" & VbCrlf)
Response.Write("<title>黄金联盟搜索——查询结果</title>" & VbCrlf)
Response.Write("<style>" & VbCrlf)
Response.Write("<!--" & VbCrlf)
Response.Write("form         { margin-bottom: 10 }" & VbCrlf)
'Response.Write("ul           { margin-top: 2; margin-bottom: 2 }" & VbCrlf)
'Response.Write("li           { margin-top: 20; margin-bottom: 2 }" & VbCrlf)
Response.Write(".top        { font-size: 10.5pt; color: red; text-decoration: none }" & VbCrlf)
Response.Write(".top:hover  { color: yellow; text-decoration: none }" & VbCrlf)
Response.Write(".top:visited{ color: #c0c0c0; text-decoration: underline }" & VbCrlf)
Response.Write("-->" & VbCrlf)
Response.Write("</style>" & VbCrlf)
%>
<script language="JavaScript">
<!--
function CheckAll2(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall2')
       e.checked = form.chkall2.checked;
    }
  }
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }
function todel() {
    if(confirm("\n真的要删除所有选中的未通过验证站点吗?     \n\n")) {
        delstaform.action = "delsta.asp"
        delstaform.method = "POST"
        delstaform.submit();
    }
}
function topass() {
    delstaform.action = "topass.asp"
    delstaform.method = "POST"
    delstaform.submit();
}
-->
</script>
<%
Response.Write("</head>" & VbCrlf)
Response.Write("<body>" & VbCrlf)

Response.Write("<hr>" & VbCrlf)
Response.Write("您查询的关键字为: <font color=red>" & keyword & "</font><br>" & VbCrlf)
Response.Write("<hr>" & VbCrlf)

if not objRS.EOF then
    Response.Write("共找到 " & recordcount)
    if UCase(si) = "SORT" then
        Response.Write(" 个相关类目<br>")
    else
        if ispass = "TRUE" then
            Response.Write("个已通过验证的相关站点<br>")
        else
            Response.Write("个有待验证的相关站点<br>")
        end if
    end if
end if        
'========================================实现翻页=============================
if pagecount > 1 then
    Response.Write("<font color=red>" & currpage & "</font>/" & pagecount & " " & VbCrlf)
    Spage = currpage mod PARTSIZE
    if currpage > PARTSIZE then
        if Spage = 0 then Spage = PARTSIZE
        Spage = currpage - Spage + 1
    else
        Spage = 1
    end if
    Epage = Spage + PARTSIZE - 1
    if Epage > pagecount then Epage = pagecount
    if currpage > PARTSIZE then
        response.write("<a href=""admsearch.asp?" & GoToPage(Query_String,Spage - 1) & """>前" & PARTSIZE & "页</a>" & VbCrlf)
    end if
    for i = Spage to Epage
        if i = currpage then
            response.write("[<font style={color:red}><b>" & i & "</b></font>]" & VbCrlf)
        else
            response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,i) & """>" & i & "</a>]" & VbCrlf)
        end if
    next
    if Epage < pagecount then
        response.write("<a href=""admsearch.asp?" & GoToPage(Query_String,Epage + 1) & """>后" & PARTSIZE & "页</a>" & VbCrlf)
    end if
    if Spage <> 1 then response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,1) & """>第一页</a>]")
    if Epage <> pagecount then response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,pagecount) & """>最末页</a>]" & VbCrlf)
    response.write("<br>")    
end if
'=============================================完成翻页==============================================

if not objRS.EOF then objRS.AbsolutePage = currpage
if UCase(si) = "SORT" then
    if objRS.EOF then
            Response.Write("<center><font color=red>无匹配类目</font></center><br>" & VbCrlf)
    else
	    Response.Write("<ul>" & VbCrlf)
    	for i = 1 to PAGESIZE
	    	if objRS.EOF then exit for
		    pid = objRS("ID")
    		sql = "select * from pathform where thispath = '" & pid & "' or thispath like '%" & chr(44) & pid & "'"
	    	Set objRS_path = objConn.Execute(sql)
		    if objRS_path.EOF then
			    'Response.Write("有错误发生<br>")
    		else
	    		Response.Write("<a href=""admclass.asp?sortid=" & pid & """>首页∷" & replace(objRS_path("pathname"),chr(255),"∷") & "</a><p>" & VbCrlf)
		    end if
    		objRS.MoveNext()
	    next
	    Response.Write("</ul></ul>")
    end if
elseif not objRS.EOF then
	Response.Write("<form name=""delstaform"" action=""delsta.asp"" method=""POST"">" & VbCrlf)
    Response.Write("<span class=""top""><input type=""checkbox"" name=""chkall"" onclick=""CheckAll(this.form)"">选中所有站点</span>  <input type=""button"" value=""删除选中的站点"" onclick=""todel()"" id=button1 name=button2>")
    if ispass = "FALSE" then
        Response.Write("  <input type=""button"" value=""加入选中的站点"" onclick=""topass()"">")
    end if
    Response.Write("<br>")
'	Response.Write("<input type=""hidden"" name=""sortid"" value=""" & sortid & """>" & VbCrlf)

	Response.Write("<ul>" & VbCrlf)
	j = ""
	for i = 1 to PAGESIZE
		if objRS.EOF then exit for
		ischg = FALSE
		pid = objRS("parentid")
		if j <> pid then
			if j <> "" then Response.Write("</ul><p>" & VbCrlf)
			j = pid
			ischg = TRUE
			sql = "select * from pathform where thispath = '" & pid & "' or thispath like '%" & chr(44) & pid & "'"
			Set objRS_path = objConn.Execute(sql)
			if objRS_path.EOF then
				'Response.Write("有错误发生<br>")
			else
				p = "<a href=""admclass.asp?sortid=" & pid & """>首页∷" & replace(objRS_path("pathname"),chr(255),"∷") & "</a>"
				Response.Write(p & "<br>")
				p = Server.URLEncode(p)
			end if
			Response.Write("<ul>" & VbCrlf)
		end if
		Response.Write("<LI type=""disc"">")
		Response.Write("<input type=""checkbox"" name=""staid"" value=""" & objRS("ID") & """>[<a href=""modify1.asp?staid=" & objRS("ID") & "&p=" & p & """ class=""top"">编辑</a>]" & VbCrlf)
		Response.Write("<a href=""" & objRS("stationurl") & """ target=""_blank"">" & objRS("stationname") & "</a> <b>" & objRS("stationlang") & "</b>" & VbCrlf)
		Response.Write("    <dl>" & VbCrlf)
		Response.Write("        <dd>" & objRS("description") & "<br><font style={font-size:10.5pt;color:#c0c0c0}>——<i> (" & objRS("whopost") & ")" &  objRS("thisdate") & " 点击:" & objRS("visitcount") & "</i></font>" & VbCrlf)
		Response.Write("    </dl>" & VbCrlf)
		Response.Write("</li>" & VbCrlf)
		objRS.MoveNext()
	next
	Response.Write("</ul></ul>")
	Response.Write("<span class=""top""><input type=""checkbox"" name=""chkall2"" onclick=""CheckAll2(this.form)"">选中所有站点</span>  <input type=""button"" value=""删除选中的站点"" onclick=""todel()"" id=button1 name=button2>")
    if ispass = "FALSE" then
        Response.Write("  <input type=""button"" value=""加入选中的站点"" onclick=""topass()"" id=1 name=1>")
    end if
	Response.Write("</form>")
else
    Response.Write("<br><center><font color=red>无匹配站点</font></center><br>" & VbCrlf)
end if

if pagecount > 1 then
    Response.Write("<font color=red>" & currpage & "</font>/" & pagecount & " " & VbCrlf)
    if currpage > PARTSIZE then
        response.write("<a href=""admsearch.asp?" & GoToPage(Query_String,Spage - 1) & """>前" & PARTSIZE & "页</a>" & VbCrlf)
    end if
    for i = Spage to Epage
        if i = currpage then
            response.write("[<font style={color:red}><b>" & i & "</b></font>]" & VbCrlf)
        else
            response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,i) & """>" & i & "</a>]" & VbCrlf)
        end if
    next
    if Epage < pagecount then
        response.write("<a href=""admsearch.asp?" & GoToPage(Query_String,Epage + 1) & """>后" & PARTSIZE & "页</a>" & VbCrlf)
    end if
    if Spage <> 1 then response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,1) & """>第一页</a>]")
    if Epage <> pagecount then response.write("[<a href=""admsearch.asp?" & GoToPage(Query_String,pagecount) & """>最末页</a>]" & VbCrlf)
    response.write("<br>")
end if

Response.Write("<hr size=1 width=70% >" & VbCrlf)
Response.Write("<center>" & VbCrlf)
%>
<!--#include file="copyright.asp"-->
<%
Response.Write("</body>" & VbCrlf)
Response.Write("</html>" & VbCrlf)
%>

<%
objConn.Close()
Set objRS = nothing
Set objRS_path = nothing
Set objConn = nothing
%>
<%
function mklikelist(recname,arr,op)
	dim i,tmparr
	tmparr = arr
	for i = 0 to UBound(tmparr)
		tmparr(i) = "(" & recname & " like '%" & tmparr(i) & "%')"
	next
	mklikelist = "(" & join(tmparr," " & op & " ") & ")"
end function
function mklikelist2(recnamearr,keyword,op)
	dim i,tmparr
	tmparr = recnamearr
	for i = 0 to UBound(tmparr)
		tmparr(i) = "(" & tmparr(i) & " like '%" & keyword & "%')"
	next
	mklikelist2 = "(" & join(tmparr," " & op & " ") & ")"
end function
function getEndID(idlist)
    dim pos
    for pos = len(idlist) to 1 step -1
        if mid(idlist,pos,1) = chr(44) then exit for
    next
    if pos < 1 then
        getEndID = idlist
    else
        getEndID = right(idlist,len(idlist) - pos)
    end if
end function
'***********************************************************
'GoToPage(Query_String,page)
'返回在参数Query_String中替换或加入“page=”page字符串
'***********************************************************
function GoToPage(Query_String,page)
    dim lens,s1,s2,pos,i
    
    lens = len(Query_String)
    pos = instr(Query_String,"page=")
    if pos = 0 or IsNull(pos) then pos = instr(Query_String,"PAGE=")
    if pos = 0 or IsNull(pos) then
        GoToPage = Query_String & "&page=" & page
        exit function
    end if
    s1 = left(Query_String,pos - 1 + len("page="))
    i = pos + len("page=")
    do while (i <= lens) and (mid(Query_String,i,1) <> "&")
        i = i + 1
    loop
    if i > lens then
        GoToPage = s1 & page
    else
        s2 = right(Query_String,lens - i)
        GoToPage = s1 & page & "&" & s2
    end if
end function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -