<!--#include file="conn.asp"-->
<!--#include file="inc/bloginfo.asp"-->
<!--#include file="inc/userinfo.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/showcode.asp"-->
<!--#include file="inc/calendar.asp"-->
<%
dim show_subjectid,strurl
dim keyword,selecttype '搜索
keyword=ReplaceBadChar(request("keyword"))
selecttype=ReplaceBadChar(request("selecttype"))
show_subjectid=clng(request.QueryString("subjectid"))
response.Write "<meta name='description' content='"&user_blogname&"'>"& vbcrlf
response.Write "<title>"&user_blogname&"</title>" & vbcrlf
response.Write "</head>" & vbcrlf
response.Write "<body>" & vbcrlf
dim MaxPerPage
dim strFileName
dim totalPut,CurrentPage,TotalPages
dim show_logcyc,show_topic,show_loginfo,show_logtext,show_more
dim show_emot,show_author,show_addtime,show_topictxt
dim rssubject,sql,mainsql
call usershow()
call sub_showlog(user_showlog_num)
show=replace(show,"$show_log$",show_log)
response.Write show
call bottom()

'**************************************************
'过程名：sub_showlog
'作  用：显示日志
'参  数：where 条件
'**************************************************
sub sub_showlog(num)
	
	MaxPerPage=num
	if request("page")<>"" then
    	currentPage=cint(request("page"))
	else
		currentPage=1
	end if
	'pagesize=num '每页显示多少篇日志
	strurl="blog.asp?name="&show_username
	if show_subjectid>0 then
		strurl="blog.asp?name="&show_username&"&subjectid="&show_subjectid
		sql=" and subjectid="&show_subjectid
	end if
	if keyword<>"" then
		select case selecttype
		case "topic"
		sql=" and topic like '%"&keyword&"%'"
		strurl="blog.asp?name="&show_username&"&keyword="&keyword&"&selecttype="&selecttype
		case "logtext"
		sql=" and logtext like '%"&keyword&"%'"
		strurl="blog.asp?name="&show_username&"&keyword="&keyword&"&selecttype="&selecttype	
		end select
	end if
	if selectdate<>"" then
		sql=" and datediff('d','"&selectdate&"',addtime)=0"
		strurl="blog.asp?name="&show_username&"&date="&selectdate
	end if
	strFileName=strurl
	Set rs=Server.CreateObject("Adodb.RecordSet")
	'===============以下为显示代码===============
	if issqldate then
		dim cmd
		Set cmd = Server.CreateObject("ADODB.Command")
		Set Cmd.ActiveConnection=conn
		Cmd.CommandType=4
		Cmd.CommandText="ob_user_showlog"
		if show_subjectid>0 then
			Cmd.CommandText="ob_user_showlog_subject"
			Cmd("@show_subjectid")=show_subjectid
		end if
		if keyword<>"" then
			select case selecttype
			case "topic"
			Cmd.CommandText="ob_user_showlog_f_topic"
			case "logtext"
			Cmd.CommandText="ob_user_showlog_f_logtxt"
			end select
		Cmd("@keyword")=keyword			
		end if
		if selectdate<>"" then
			Cmd.CommandText="ob_user_showlog_selectdate"
			Cmd("@selectdate")=selectdate
		end if
		'Cmd.Parameters.Append cmd.CreateParameter("@pagenow",3)
		sql=""
		Cmd.CommandText="ob_user_showlog"
		Cmd("@show_username")=show_username
		Cmd("@addstr")=sql
		rs.CursorLocation = 3
		rs.open cmd,,3,1				
		'set rs=cmd.Execute
		set cmd=nothing
	else
		mainsql=("select face,topic,subjectid,id,username,addtime,logtext,ishide,commentnum,showword,ispassword,iis,trackback,isbest,blog_password,author from blog where passcheck<>'false' and username='"&show_username&"'"&sql&" order by addtime desc")
		rs.open mainsql,conn,1,1
	end if
	
	if rs.eof and rs.bof then
		show_log=show_log & "共调用0篇日志<br>"
	else
    	totalPut=rs.recordcount
		show_log=show_log & "共调用" & totalPut & " 篇日志<br>"
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
	    if currentPage=1 then
        	getlog()
        	show_log=show_log&fshowpage(strFileName,totalput,MaxPerPage,false,true,"篇日志")
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	getlog()
            	show_log=show_log&fshowpage(strFileName,totalput,MaxPerPage,false,true,"篇日志")
        	else
	        	currentPage=1
           		getlog()
           		show_log=show_log&fshowpage(strFileName,totalput,MaxPerPage,false,true,"篇日志")
	    	end if
		end if
	end if
	rs.Close
	set rs=Nothing
end sub

sub getlog()
dim i
do while not rs.eof
					if rs(7)<>"true" or Request.Cookies(cookiesname)("UserName")=rs(4) or Request.Cookies(cookiesname)("userlevel")=9 or vipsee=true then
						show_emot="<img src=images/face/"&rs(0)&".gif >"
						if isnull(rs(15)) then
							if nickname<>"" then show_author=nickname else show_author=rs(4)
						else 
							if rs(15)=rs(4) then
								if nickname<>"" then show_author=nickname else show_author=rs(4)
							else
								dim rstmp
								set rstmp=conn.execute("select nickname from [user] where username='"&rs(15)&"'")
								if rstmp.eof then
									show_author=rs(15)
								else
									if rstmp(0)<>"" then show_author=rstmp(0) else show_author=rs(15)
								end if
								set rstmp=nothing
							end if
						end if
						show_addtime=rs(5)
						show_topic=show_emot
						if rs(2)>0 then
							set rssubject=conn.execute("select id,subjectname from subject where id="&rs(2))
							if not (rssubject.eof and rssubject.bof) then
								show_topic=show_topic&"<a href=blog.asp?name="&rs(4)&"&subjectid="&rssubject(0)&">["&rssubject(1)&"]"
							end if
							set rssubject=nothing
						end if
					show_topictxt="<a href=more.asp?name="&rs(4)&"&id="&rs(3)&">"&rs(1)&"</a>"
					if rs(13)="true" then
						show_topictxt=show_topictxt&"　<img src=images/jhinfo.gif >"
					end if
					show_topic=show_topic&show_topictxt
					show_loginfo=show_author&" 发表于 "&show_addtime
					show_more="<a href=more.asp?name="&rs(4)&"&id="&rs(3)&">阅读全文("&rs(11)&")</a>"
					show_more=show_more&" | "&"<a href=more.asp?name="&rs(4)&"&id="&rs(3)&"#comment>回复("&rs(8)&")</a>"
					show_more=show_more&" | "&"<a href=showtb.asp?id="&rs(3)&" target=_blank>引用("&rs(12)&")</a>"
					
					if rs(10)<>"" and Request.Cookies(cookiesname)("UserName")<>rs(4) and Request.Cookies(cookiesname)("userlevel")<>9 and vipsee=false then
						show_logtext="<div align=center><a href=more.asp?name="&rs(4)&"&id="&rs(3)&">此日志需要密码访问。</a></div>"
					elseif rs(14)<>"" and Request.Cookies(cookiesname)("UserName")<>rs(4) and Request.Cookies(cookiesname)("userlevel")<>9 and vipsee=false and Request.Cookies(cookiesname)("blog_password")<>rs(14) then
						show_logtext="<div align=center><a href=more.asp?name="&rs(4)&"&id="&rs(3)&">该blog需要密码访问。</a></div>"
					else
						show_logtext=filtscript(rs(6))
						show_logtext=trimlog(show_logtext,rs(9))
						show_logtext=filtimg(show_logtext)
						if blog_profilt="true" then
							show_logtext=profilthtm(show_logtext)
						end if
					end if
					show_logcyc=replace(show_logtmp,"$show_topic$",show_topic)
					show_logcyc=replace(show_logcyc,"$show_loginfo$",show_loginfo)
					show_logcyc=replace(show_logcyc,"$show_logtext$",show_logtext)
					show_logcyc=replace(show_logcyc,"$show_more$",show_more)
					show_logcyc=replace(show_logcyc,"$show_emot$",show_emot)
					show_logcyc=replace(show_logcyc,"$show_author$",show_author)
					show_logcyc=replace(show_logcyc,"$show_addtime$",show_addtime)
					show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topictxt)
				end if
				rs.movenext
			show_log=show_log&show_logcyc
		i=i+1
	if i>=MaxPerPage then exit do
	loop
end sub
%>