list.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 161 行

ASP
161
字号
<!--#include file="inc/inc_syssite.asp"-->
<!--#include file="inc/syscode.asp"-->
<%
dim mainsql,classid,strurl,rsmain,show_list,ustr
dim keyword,selecttype,isbest,bstr1,userid
classid=Int(request.QueryString("classid"))
keyword=EncodeJP(oblog.filt_badstr(request("keyword")))
selecttype=oblog.filt_badstr(request("selecttype"))
isbest=Int(request.QueryString("isbest"))
userid=Int(request.QueryString("userid"))
call sysshow()
strurl="list.asp"
if classid<>0 then
	set rsmain=oblog.execute("select id from oblog_logclass where parentpath like '"&classid&",%' OR parentpath like '%,"&classid&"' OR parentpath like '%,"&classid&",%'")
	while not rsmain.eof
		ustr=ustr&","&rsmain(0)
		rsmain.movenext
	wend
	ustr=classid&ustr
	mainsql=" and a.classid in ("&ustr&")"
	'mainsql=" and oblog_log.classid="&classid
	strurl="list.asp?classid="&classid
end if
if keyword<>"" then
	select case selecttype
	case "topic"
		mainsql=" and topic like '%"&keyword&"%'"
		strurl="list.asp?keyword="&keyword&"&selecttype="&selecttype
	case "logtext"
		if oblog.cacheConfig(26)=1 then
		mainsql=" and logtext like '%"&keyword&"%'"
		strurl="list.asp?keyword="&keyword&"&selecttype="&selecttype
		else
		oblog.adderrstr("当前系统已经关闭日志内容搜索。")
		oblog.showerr
		end if
	case "id"
		mainsql=" and author like '%"&keyword&"%'"
		strurl="list.asp?keyword="&keyword&"&selecttype="&selecttype
	end select
end if
if isbest=1 then
	mainsql=mainsql&" and isbest=1"
	if strurl="list.asp" then
		strurl=strurl&"?isbest=1"
	else
		strurl=strurl&"&isbest=1"
	end if
	bstr1="→精华日志"
end if
if userid>0 then
	mainsql=mainsql&" and userid="&userid
	if strurl="list.asp" then
		strurl=strurl&"?userid="&userid
	else
		strurl=strurl&"&userid="&userid
	end if
end if
call sub_showlist(mainsql,strurl)
G_P_Show=replace(G_P_Show,"$show_list$",show_list)
response.Write G_P_Show&oblog.site_bottom

sub sub_showlist(sql,strurl)
	dim topn
	dim msql
	G_P_PerMax=Int(oblog.CacheConfig(36))
	G_P_FileName=strurl
	if request("page")<>"" then
    	G_P_This=cint(request("page"))
	else
		G_P_This=1
	end if
	topn=oblog.CacheConfig(37)
	msql="select top "&topn&" a.topic,a.author,a.addtime,a.commentnum,a.logid,b.classname,b.id,userid,logfile,a.isbest from oblog_log a,oblog_logclass b where a.classid=b.id and isdel=0 and ishide=0 and passcheck=1 and isdraft=0 and blog_password=0"&sql
	msql=msql&" order by a.logid desc"
	Set rsmain=Server.CreateObject("Adodb.RecordSet")
	'response.Write(msql)
	if not IsObject(conn) then link_database
	rsmain.Open msql,Conn,1,1
  	if rsmain.eof and rsmain.bof then
		show_list=show_list & "共调用0篇日志<br>"
	else
    	G_P_AllRecords=rsmain.recordcount
		show_list=show_list & "共调用" & G_P_AllRecords & " 篇日志<br>"
		if G_P_This<1 then
       		G_P_This=1
    	end if
    	if (G_P_This-1)*G_P_PerMax>G_P_AllRecords then
	   		if (G_P_AllRecords mod G_P_PerMax)=0 then
	     		G_P_This= G_P_AllRecords \ G_P_PerMax
		  	else
		      	G_P_This= G_P_AllRecords \ G_P_PerMax + 1
	   		end if
    	end if
	    if G_P_This=1 then
        	getlist()
        	show_list=show_list&oblog.showpage(false,true,"篇日志")
   	 	else
   	     	if (G_P_This-1)*G_P_PerMax<G_P_AllRecords then
         	   	rsmain.move  (G_P_This-1)*G_P_PerMax
         		dim bookmark
           		bookmark=rsmain.bookmark
            	getlist()
            	show_list=show_list&oblog.showpage(false,true,"篇日志")
        	else
	        	G_P_This=1
           		getlist()
           		show_list=show_list&oblog.showpage(false,true,"篇日志")
	    	end if
		end if
	end if
	rsmain.Close
	set rsmain=Nothing
end sub

sub getlist()
	dim i,strtopic,userurl,bstr
	show_list="<table width='100%' border='0'><tr><td>"
	if keyword="" then
		if classid<>0 then
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→日志类别("&rsmain(5)&")"
		else
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→日志列表(所有类别)"	
		end if
	else
		select case selecttype
		case "topic"
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→搜索日志标题关键字“"&keyword&"”"
		case "logtext"
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→搜索日志内容关键字“"&keyword&"”"
		case "id"
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→搜索博客名称关键字“"&keyword&"”"
		case else
			show_list=show_list&"当前位置:<a href='index.asp'>首页</a>→搜索关键字“"&keyword&"”"
		end select
	end if
	bstr=trim(Request.ServerVariables("query_string"))
	if bstr<>"" then bstr="list.asp?"&replace(replace(bstr,"&isbest=1",""),"isbest=1","")&"&isbest=1" else bstr="list.asp?isbest=1"
	show_list=show_list&bstr1&"</td><td align='right'><a href='"&bstr&"'>查看精华日志</a></td></tr></table><hr>"
	show_list=show_list&"<table width='100%' border='0'><tr>"
	show_list=show_list&"<td><strong>日志标题</strong></td><td width='100' align='center'><strong>作者</strong></td><td width='60' align='center'><strong>日期</strong></td><td width='40' align='center'><strong>评论</strong></td></tr>"
	do while not rsmain.eof
	If rsmain("isbest")=1 Then
		strtopic="<font color=red>" & oblog.filt_html(rsmain(0)) & "</font>"
	Else
		strtopic=oblog.filt_html(rsmain(0))
	End If
	if oblog.strLength(strtopic)>50 then
		strtopic=oblog.InterceptStr(strtopic,47)&"..."
	end if
	show_list=show_list&"<tr><td><a href='"&rsmain(8)&"' title='"&oblog.filt_html(rsmain(0))&"' target=_blank>"&strtopic&"</a></td>"
	show_list=show_list&"<td align='center'><a href='go.asp?userid="&rsmain(7)&"' target=_blank>"&oblog.filt_html(rsmain(1))&"</a></td>"
	show_list=show_list&"<td align='center'>"&mid(formatdatetime(rsmain(2),2),6)&"</td>"
	show_list=show_list&"<td align='center'>"&rsmain(3)&"</td></tr>"
	rsmain.movenext
	i=i+1
	if i>=G_P_PerMax then exit do
	loop
	show_list=show_list&"</table>"
end sub
%>

⌨️ 快捷键说明

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