user_blogmanage.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 730 行 · 第 1/2 页

ASP
730
字号
<!--#include file="user_top.asp"-->
<!--#include file="inc/class_blog.asp"-->
<%
'获取用户日志专辑分类
Dim rsSubject,sClass
Set rsSubject=Server.CreateObject("Adodb.Recordset")
rsSubject.Open "Select subjectid,subjectname From oblog_subject Where userid=" & oblog.l_uid & " And subjecttype=" &t,conn,1,3
If rsSubject.Eof Then
'	sClass= "您还没有设置相关日志分类"
	sClass="<select name=subjectid1 disabled>"
	sClass=sClass & "<option value=0>您还没有设置相关日志分类</option>"	
	sClass=sClass & "</select>"
Else
	sClass="<select name=subjectid1>"
	Do While Not rsSubject.Eof
		sClass=sClass & "<option value=" & rsSubject("subjectid") & ">" & rsSubject("subjectname") & "</option>"
		rsSubject.movenext
	Loop
	sClass=sClass & "</select>"
End If

%>
<script src="oBlogStyle/move.js" type="text/javascript"></script>
<script language=javascript>
<!--
function initialize()
{
	var a = new xWin("1",300,150,292,40,"重新发布","<p>重新发布</p><p><input name='Submit' type='image' src='oBlogStyle/UserAdmin/4/btu_ok.png' value='确认修改' onclick='ShowHide(\"1\",null)' style='cursor:pointer;' /></p>");
	var b = new xWin("2",200,80,386,40,"移动专题","<p>目标专题:<%=sClass%><br/><br/><input name='Submit' type='button'  value='移动' onclick='document.myform.action.value=\"move\";document.myform.subjectid.value=document.all.subjectid1.value;document.myform.submit();ShowHide(\"2\",null)' style='cursor:pointer;' />&nbsp;&nbsp;<input name='Submit' type='button' value='关闭' onclick='ShowHide(\"2\",null);'/></p>");
	ShowHide("1","none");//隐藏窗口
	ShowHide("2","none");//隐藏窗口
}
window.onload = initialize;
//-->
</script>
<style type="text/css">
<!--
	#content_li .content_li_conten .t2 {color:#f60;}
-->
</style>
</head>
<body scroll="no" style="overflow:auto!important;overflow:hidden;background:#fff;">
<%
Dim rs,sql,id, usersearch, Keyword, sField, uid, action
Dim selectsub, substr, wsql, allsub,truedel ,isdraft
truedel=False
isdraft=False
Keyword = Trim(request("keyword"))
If Keyword <> "" Then Keyword = oblog.filt_badstr(Keyword)
sField = Trim(request("Field"))
usersearch = Trim(request("usersearch"))
selectsub = Trim(request("selectsub"))
action = Trim(request("action"))
id = request("id")
If id<>"" And Instr(id,",")<=0 Then id=Int(id)
uid = Int(request("uid"))
G_P_FileName = "user_blogmanage.asp?t=" & t
If usersearch = "" Then
    usersearch = 0
Else
    usersearch = Int(usersearch)
    G_P_FileName = "user_blogmanage.asp?usersearch=" & usersearch & "&t=" & t
End If
'request("truedel")删除单篇日志
if usersearch=6 Or LCase(request("truedel"))="true" Then truedel=True
if usersearch=5 then isdraft=True
If selectsub <> "" Then
    selectsub = Int(selectsub)
    G_P_FileName = "user_blogmanage.asp?usersearch=10&selectsub=" & selectsub & "&t=" & t
Else
    selectsub = 0
End If
If Keyword <> "" Then
    G_P_FileName="user_blogmanage.asp?usersearch=10&keyword="&Keyword&"&Field="&sField & "&t="  & t
End If

G_P_FileName =G_P_FileName & "&page="
If request("page") <> "" Then G_P_This = Int(request("page")) Else G_P_This = 1
wsql=" and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )"

Select Case LCase(action)
    Case "del"
        Call delblog
    Case "move"
        Call moveblog
    Case "updatelog"
        Call updatelog
    Case "downlog"
        Call BackUp
	Case "delall"
		Call delallblog
    Case Else
        Call main
End Select
Set rs = Nothing
%>

<div id="user_page_search">
    <form name="form1" action="user_blogmanage.asp" method="get">
    	
        <input type="hidden" name="t" value="<%=t%>">
快速查找:
        <select size=1 name="usersearch" onChange="javascript:submit()">
          <option value="10" selected>请选择查找类型</option>
          <option value="0">列出所有<%=tName%></option>
          <option value="1">未通过审核的<%=tName%></option>
          <option value="2">已通过审核的<%=tName%></option>
          <option value="3">推荐<%=tName%></option>
           <option value="5">草稿箱</option>
        </select> &nbsp;
      按专题查找:&nbsp;
        <select name="selectsub" id="selectsub" onChange="javascript:submit()">
<%
Response.Write "<option value=''>请选择专题</option>"
Set rs = oblog.Execute("select subjectid,subjectname from oblog_subject where userid=" & oblog.l_uId & " And subjecttype=" & t)
While Not rs.EOF
    substr=substr&"<option value="&rs(0)&">"&rs(1)&"</option>"
    allsub=allsub&rs(0)&"!!??(("&rs(1)&"##))=="
    rs.Movenext
Wend

Response.Write (substr)
Response.Write "<option value=0>未分类</option>"
%>
        </select>&nbsp;
搜索:
        <select name="Field" id="Field">
            <option value="id"><%=tName%>ID号</option>
            <option value="topic" selected><%=tName%>标题</option>
            <option value="tag">标签(TAG)</option>
         </select>
         <input name="Keyword" type="text" id="Keyword" size="20" maxlength="30">
         <input type="submit" name="Submit2" value=" 搜索 ">
  </form>
</div>

</div>


<div id="user_post_track">
</div>
<div id="user_post_update">
</div>
</body>
</html>
<%
Set rsSubject=Nothing

Sub main()
    Server.ScriptTimeOut = 999999999
    Dim  selectsql,i,lPage,lAll,lPages,iPage
    selectsql = "logid,userid,iis,commentnum,topic,author,addtime,logfile,isbest,isdraft,passcheck,subjectid,istop,ispassword,ishide,classid,authorid"
    G_P_Guide = ""
    Select Case usersearch
        Case 0
            sql="select "&selectsql&" from oblog_log where isdel=0 And logtype=" & t & " And ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&") order by istop desc,logid desc"
            G_P_Guide = G_P_Guide & "所有" & tName
        Case 1
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And passcheck=0 And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by logid desc"
            G_P_Guide = G_P_Guide & "未通过审核" & tName
        Case 2
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And passcheck=1  And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by logid desc"
            G_P_Guide = G_P_Guide & "已通过审核" & tName
        Case 3
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And isbest=1  And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by logid desc"
            G_P_Guide = G_P_Guide & "推荐" & tName
        Case 4
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )  And logtype=" & t & " order by logid desc"
            G_P_Guide = G_P_Guide & "我的" & tName
        Case 5
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And isdraft=1  And logtype=" & t & "  and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by logid desc"
            G_P_Guide = G_P_Guide & "草稿箱"
		 Case 6
            sql="select "&selectsql&" from [oblog_log] where  isdel=1  And logtype=" & t & "  and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by logid desc"
            G_P_Guide = G_P_Guide & "回收站"
        Case 10
            If Keyword = "" Then
                sql="select "&selectsql&" from [oblog_log] where  isdel=0 And (userid="&oblog.l_uid&" or authorid="&oblog.l_uid&") and subjectid="&selectsub&"   And logtype=" & t & " order by logid desc"
                G_P_Guide=G_P_Guide & "专题id为"&selectsub&"的" & tName
            Else
                Select Case sField
                Case "id"
                    If IsNumeric(Keyword) = False Then
                        oblog.adderrstr (tName & "id必须是整数!")
                        oblog.showusererr
                    Else
                        sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logid =" & Int(Keyword)&"  And logtype=" & t & " and (userid="&oblog.l_uid&" or authorid="&oblog.l_uid&")"
                        G_P_Guide = G_P_Guide & "id等于<font color=red> " & Int(Keyword) & " </font>的" & tName
                    End If
                Case "topic"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And topic like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by logid desc"
                    G_P_Guide = G_P_Guide & "标题中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                Case "tag"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logTags like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by logid desc"
                    G_P_Guide = G_P_Guide & "标签中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                Case "content"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logtext like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by logid desc"
                    G_P_Guide = G_P_Guide & "正文中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                End Select
            End If
        Case Else
            oblog.adderrstr ("错误的参数")
            oblog.showusererr
    End Select
    Set rs = Server.CreateObject("Adodb.RecordSet")
    'response.Write(sql)
    rs.open sql, conn, 1, 3
    lAll=INT(rs.recordcount)
    If lAll=0 Then
    	%>
    <div id="user_page_content">
    	<div id="content_li">
    	<ul class="content_li_conten" id="u0">    		
			<li class="t1"></li><li class="t3"></li>
			</ul>
    	<ul class="content_li_conten" id="u1">    		
			<li class="t1">&nbsp;</li><li class="t3"><center><%=G_P_Guide & " 没有相关记录"%></center></li>
			</ul>
			</div>
		</div>
		<%
    	rs.Close
    	Set rs=Nothing
    	Exit Sub
    End If
    i=0
    iPage=12
	'分页
	If Request("page") = "" Or Request("page") ="0" then
		lPage = 1
	Else
		lPage = Int(Request("page"))
	End If
	
	'设置缓存大小 = 每页需显示的记录数目
	rs.CacheSize = iPage
	rs.PageSize = iPage
	rs.movefirst		
	lPages = rs.PageCount
	If lPage>lPages Then lPage=lPages
	rs.AbsolutePage = lPage
	i=0
	%>
<style type="text/css">
<!--
	.content_li_top .t2 {width:110px;padding-left:2px;}
	#content_li .t2 {width:110px;padding:6px 0 4px 0;}
	.content_li_top .t3 {margin:-1px 0 0 0;}
	.content_li_top .t4 {margin:-2px 0 0 0;}
	.content_li_conten .t4 {font-weight:600;font-family:Century Gothic,verdana,tahoma,Arial,Helvetica,sans-serif;font-size:10px;}
	.content_li_conten .t5 {margin:-1px 0 0 0;color:#999;}
-->
</style>
<ul id="user_page_top">
	<li id="p7"><a href="#" onclick="chk_idAll(myform,1);">全部选择</a></li>
	<li id="p8"><a href="#" onclick="chk_idAll(myform,0);">全部取消</a></li>
	<li id="p4"><a href="#" onclick="if (chk_idBatch(myform,'删除选中的<%=tName%>吗?')==true) {document.myform.action.value='del'; document.myform.submit();}"><%if truedel then response.Write("彻底删除") else response.Write("日志删除")%></a></li>
  <li id="p6"><a href="#" onclick="if (chk_idBatch(myform,'重新发布选中的<%=tName%>吗?')==true) {document.myform.action.value='updatelog'; document.myform.submit();}"><%if truedel then response.Write("恢复日志") else response.Write("重新发布")%></a></li>
  <%if not truedel then%>
  <li id="p5"><a href="#" onclick="ShowHide('2',null);return false;">移动专题</a></li>
  <%Else%>
  <li id="p4"><a href="#" onclick="chk_idAll(myform,1);if (chk_idBatch(myform,'清空回收站中所有的<%=tName%>吗?')==true) {document.myform.action.value='delall'; document.myform.submit();}">清空回收站</a></li>
  <%end if%>
</ul>
<div id="showpage">
<%=MakeMiniPageBar(lAll,iPage,lPage,G_P_FileName)%>
</div>
<form name="myform" method="Post" action="user_blogmanage.asp?t=<%=t%>&usersearch=<%=usersearch%>" onSubmit="return confirm('确定要执行选定的操作吗?');">
   <div id="user_page_content">
		<ul class="content_li_top">
			<li class="t1">选中</li>
			<li class="t11">日志分类</li>
			<li class="t2">我的专题</li>
			<li class="t3">日志标题&nbsp;[<%=G_P_Guide%>]</li>
			<li class="t4">点/评</li>
			<li class="t5">发表时间</li>
			<li class="t6">操作</li>
		</ul>
		<div id="content_li">
	<%
	Do While Not rs.Eof And i < rs.PageSize
		i=i+1
		Dim classname,trs
		Set trs = oblog.execute ("SELECT classname FROM oblog_logclass WHERE id = "& rs("classid"))
		If Not trs.eof Then 
			classname=trs(0)
		Else 
			classname="未分类"
		End if
		%>
		<ul class="content_li_conten" id="u<%=rs("logid")%>"  onclick="chk_iddiv('<%=rs("logid")%>')">
			<li class="t1" title="点击选中"><input name='id' type='checkbox' id="c<%=rs("logid")%>" value='<%=rs("logid")%>' onclick="chk_iddiv('<%=rs("logid")%>')"/></li>	
			<li class="t11"><%=classname%></li>
			<li class="t2" title="<%
	    	If Not IsNull(rs("subjectid")) And rs("subjectid")<>"" Then
		    	rsSubject.Filter="subjectid=" & rs("subjectid")
		    	If Not rsSubject.Eof Then
		    		Response.Write rsSubject("subjectname")
		    	Else
		    		Response.Write  "未分类"
		    	End If
		    Else
		    		Response.Write  "未分类"
		  	End If
	    	%>">
	    	<%
	    	If Not IsNull(rs("subjectid")) And rs("subjectid")<>"" Then
		    	rsSubject.Filter="subjectid=" & rs("subjectid")
		    	If Not rsSubject.Eof Then
		    		Response.Write rsSubject("subjectname")
		    	Else
		    		Response.Write  "<span style=""color:#999;"">未分类</span>"
		    	End If
		    Else
		    		Response.Write  "<span style=""color:#999;"">未分类</span>"
		  	End If
	    	%>
</li>
				<%If rs("logfile")<>"" then%>
				<li class="t3">
					<%If rs("userid")<>rs("authorid") Then %>[共同撰写]<%End if%>
					<%If rs("passcheck")=0 Then Response.Write "[待审]"%>
					<a href="<%=rs("logfile")%>" target="_blank" title="<%=tName%><%=oblog.filt_html(rs("topic"))%>" ><%=oblog.filt_html(Left(rs("topic"),20))%></a></li>
			<%Else%>
				<li class="t3"><span class="txt9">[草稿]</span> <a href="user_post.asp?logid=<%=rs("logid")%>"  title="<%=tName%><%=oblog.filt_html(rs("topic"))%>"><%=oblog.filt_html(rs("topic"))%></a></li>
			<%End If%>
				<%
				If rs("istop")=1 Then
				%>
				 <img src="oBlogStyle/level/light.gif" alt="该篇文章被您设置为固顶" align="absmiddle" />
				<%
				End If
				If rs("isbest")=1 Then
				%>
				 <img src="oBlogStyle/level/tu-001.gif" alt="该篇文章被系统管理员设置为精华" align="absmiddle" />
				 <%
				End If
				If OB_IIF(rs("ispassword"),"")<>"" Then
				%>
				 <img src="oBlogStyle/level/lock.gif" alt="该篇文章被您设置为加密" align="absmiddle" />
				 <%
				End If
				If rs("ishide")=1 Then
				%>
				 <img src="oBlogStyle/level/hidden.gif" alt="该篇文章被您设置为隐藏,仅对好友可见" align="absmiddle" />
				  <%
				End If
				%>
			</li>
			<li class="t4"><%=rs("iis")&"/"&rs("commentnum")%></li>
			<li class="t5" title="<%=formatdatetime(rs("addtime"),2) %>"><%=formatdatetime(rs("addtime"),1)%> 				
				</li>
			<li class="t6">
			<%if truedel then%>
				<a href="user_blogmanage.asp?action=updatelog&id=<%=rs("logid")%>&userid=<%=rs("userid")%>" onClick="return confirm('确定要恢复此日志吗?');">恢复</a>
			<%else%>
			<a href="user_post.asp?logid=<%=rs("logid")%>"  title="<%=tName%><%=oblog.filt_html(rs("topic"))%>">修改</a><%End if%>&nbsp;<a href="user_blogmanage.asp?action=del&id=<%=rs("logid")%>&truedel=<%=truedel%>" onClick="return confirm('确定要删除此日志吗?');">删除</a></li>
		</ul>
		<%
		rs.MoveNext
	Loop
    rs.Close
    Set rs = Nothing
%>
</div>

⌨️ 快捷键说明

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