?? user_blog.asp
字號(hào):
<!--#include file="conn.asp"-->
<!--#include file="user_chkpass.asp"-->
<!--#include file="inc/usercode.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/md5.asp"-->
<%
if CheckUserLogined()=False then
response.Redirect "user_login.asp"
end if
dim needclassid
needclassid=trim(Application(cachename&"info")(3))
%>
<SCRIPT language=javascript>
function del_space(s)
{
for(i=0;i<s.length;++i)
{
if(s.charAt(i)!=" ")
break;
}
for(j=s.length-1;j>=0;--j)
{
if(s.charAt(j)!=" ")
break;
}
return s.substring(i,++j);
}
function VerifySubmit()
{
submits();
topic = del_space(document.form2.topic.value);
if (topic.length == 0)
{
alert("您忘了填寫(xiě)題目!");
return false;
}
var needclassid=<%=needclassid%>
if (needclassid==true) {
if (document.form2.classid.value == 0)
{
alert("請(qǐng)選擇日志的類(lèi)別!");
return false;
}
}
showword = del_space(document.all("showword").value);
for(i = 0; i < showword.length; i++){
if(showword.charAt(i) < "0" || showword.charAt(i) > "9"){
alert("請(qǐng)輸入正確的顯示字?jǐn)?shù)!");
return false;
}
}
if (document.form2.edit.value == "")
{
alert("請(qǐng)輸入日志內(nèi)容!");
return false;
}
var date=document.form2.selecty.value+"-"+document.form2.selectm.value+"-"+document.form2.selectd.value
var datereg=/^(\d{4})-(\d{1,2})-(\d{1,2})$/
var datareg=/^(\d){1,2}$/
if (!datereg.test(date)){
alert("日志時(shí)間輸入格式錯(cuò)誤");
return false;
}
var r=date.match(datereg)
var d=new Date(r[1],r[2]-1,r[3])
if (!(d.getFullYear()==r[1]&&d.getMonth()==r[2]-1&&d.getDate()==r[3])){
alert("日志時(shí)間輸入格式錯(cuò)誤");
return false;
}
var sdate=document.form2.serverdate.value
date = date.replace(/\-/g,"\/");
sdate = sdate.replace(/\-/g,"\/");
if ((new Date(date) > new Date(sdate))){
alert("日志日期不能大于今天!");
return false;
}
return true;
}
</SCRIPT>
<%
const MaxPerPage=20
dim strFileName
dim totalPut,CurrentPage,TotalPages
dim rs, sql
dim ID,UserSearch,Keyword,strField,uname
dim Action,FoundErr,ErrMsg
dim tmpDays,usersql
dim uppath
keyword=trim(request("keyword"))
if keyword<>"" then
keyword=ReplaceBadChar(keyword)
end if
strField=trim(request("Field"))
UserSearch=trim(request("UserSearch"))
Action=trim(request("Action"))
ID=trim(Request("ID"))
uname=trim(Request("uname"))
ComeUrl=Request.ServerVariables("HTTP_REFERER")
if UserSearch="" then
UserSearch=0
else
UserSearch=Clng(UserSearch)
end if
strFileName="user_blog.asp?UserSearch=" & UserSearch
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<html>
<head>
<title>用戶日志管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
function unselectall()
{
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
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;
}
}
</SCRIPT>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
<tr class="topbg">
<td height="22" colspan=2 align=center><strong>用 戶 日 志 管 理</strong></td>
</tr>
<form name="form1" action="User_blog.asp" method="get">
<tr class="tdbg">
<td width="100" height="30"><strong>快速查找日志:</strong></td>
<td width="687" height="30"><select size=1 name="UserSearch" onChange="javascript:submit()">
<option value="0">列出所有日志</option>
<option value="1">未通過(guò)審核的日志</option>
<option value="2">已通過(guò)審核的日志</option>
<option value="3">推薦日志</option>
<%if userlevel=9 then%><option value="4">我的日志</option><%end if%>
<option value="10" selected> </option>
</select>
<a href="User_blog.asp">日志管理首頁(yè)</a> | <a href="User_addblog.asp">添加新日志</a></td>
</tr>
</form>
</table>
<br>
<%
if Action="SaveAdd" then
call SaveAdd()
elseif Action="Modify" then
call Modify()
elseif Action="SaveModify" then
call SaveModify()
elseif Action="Del" then
call Delblog()
elseif Action="Lock" then
call Lockblog()
elseif Action="UnLock" then
call passblog()
elseif Action="isbest" then
call isbest()
elseif Action="unisbest" then
call unisbest()
else
call main()
end if
if FoundErr=True then
call WriteErrMsg()
end if
sub main()
dim strGuide
strGuide="<table width='98%' align='center'><tr><td align='left'>您現(xiàn)在的位置:<a href='User_blog.asp'>用戶日志管理</a> >> "
select case UserSearch
case 0
if userlevel=9 then
sql="select * from [blog] order by addtime desc"
else
sql="select * from [blog] where username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "所有日志"
case 1
if userlevel=9 then
sql="select * from [blog] where passcheck='false' order by addtime desc"
else
sql="select * from [blog] where passcheck='false' and username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "未通過(guò)審核日志"
case 2
if userlevel=9 then
sql="select * from [blog] where passcheck='true' order by addtime desc"
else
sql="select * from [blog] where passcheck='true' and username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "已通過(guò)審核日志"
case 3
if userlevel=9 then
sql="select * from [blog] where isbest='true' order by addtime desc"
else
sql="select * from [blog] where isbest='true' and username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "推薦日志"
case 4
sql="select * from [blog] where username='"&username&"' order by addtime desc"
strGuide=strGuide & "我的日志"
case 10
if Keyword="" then
if userlevel=9 then
sql="select * from [blog] order by addtime desc"
else
sql="select * from [blog] where username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "所有日志"
else
select case strField
case "ID"
if IsNumeric(Keyword)=False then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>ID必須是整數(shù)!</li>"
else
if userlevel=9 then
sql="select * from [blog] where ID =" & Clng(Keyword)&" and username='"&username&"'"
else
sql="select * from [blog] where ID =" & Clng(Keyword)
end if
strGuide=strGuide & "日志ID等于<font color=red> " & Clng(Keyword) & " </font>的用戶"
end if
case "topic"
if userlevel=9 then
sql="select * from [blog] where topic like '%" & Keyword & "%' order by addtime desc"
else
sql="select * from [blog] where topic like '%" & Keyword & "%' and username='"&username&"' order by addtime desc"
end if
strGuide=strGuide & "標(biāo)題中含有“ <font color=red>" & Keyword & "</font> ”的日志"
end select
end if
case else
FoundErr=True
ErrMsg=ErrMsg & "<br><li>錯(cuò)誤的參數(shù)!</li>"&sql
end select
strGuide=strGuide & "</td><td align='right'>"
if FoundErr=True then exit sub
Set rs=Server.CreateObject("Adodb.RecordSet")
'response.Write userlevel
'response.Write(sql)
rs.Open sql,Conn,1,1
if rs.eof and rs.bof then
strGuide=strGuide & "共找到 <font color=red>0</font> 個(gè)日志</td></tr></table>"
response.write strGuide
else
totalPut=rs.recordcount
strGuide=strGuide & "共找到 <font color=red>" & totalPut & "</font> 個(gè)日志</td></tr></table>"
response.write strGuide
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
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"個(gè)日志"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"個(gè)日志"
else
currentPage=1
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"個(gè)日志"
end if
end if
end if
rs.Close
set rs=Nothing
call ShowSearch()
end sub
sub showContent()
dim i
i=0
%>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
<tr>
<form name="myform" method="Post" action="User_blog.asp" onsubmit="return confirm('確定要執(zhí)行選定的操作嗎?');">
<td>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
<tr class="title">
<td width="29" align="center"><font color="#FFFFFF">選中</font></td>
<td width="29" align="center"><font color="#FFFFFF">ID</font></td>
<td width="56" height="22" align="center"><span class="style1">發(fā)表人</span> </td>
<td width="251" height="22" align="center"><font color="#FFFFFF">文章標(biāo)題</font></td>
<td width="104" align="center"><font color="#FFFFFF">發(fā)表時(shí)間</font></td>
<td width="35" height="22" align="center"><font color="#FFFFFF">推薦</font></td>
<td width="35" height="22" align="center"><font color="#FFFFFF"> 狀態(tài)</font></td>
<td width="185" height="22" align="center"><font color="#FFFFFF">
操作</font></td>
</tr>
<%do while not rs.EOF %>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td width="29" align="center"><input name='ID' type='checkbox' onclick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>
<input name='uname' type="hidden" id="uname" value='<%=trim(rs("username"))%>'></td>
<td width="29" align="center"><%=rs("ID")%></td>
<td width="56" align="center"><%=rs("username")%>
</td>
<td align="center"> <a href=more.asp?name=<%=rs("username")%>&id=<%=rs("id")%> target=_blank><%=rs("topic")%> </a> </td>
<td align="center"> <%
if rs("addtime")<>"" then
response.write rs("addtime")
else
response.write " "
end if
%> </td>
<td width="35" align="center"> <%
if rs("isbest")="true" then
response.write "<font color=red>推薦</font>"
else
response.write " "
end if
%> </td>
<td width="36" align="center"><%
if rs("passcheck")="false" then
response.write "<font color=red>未審</font>"
else
response.write "已審"
end if
%></td>
<td width="185" align="center">
<%
response.write "<a href='User_blog.asp?Action=Modify&ID=" & rs("ID") & "'>修改</a> "
if userlevel=9 then
if rs("passcheck")="true" then
response.write "<a href='User_blog.asp?Action=Lock&ID=" & rs("ID") & "'>設(shè)為未審</a> "
else
response.write "<a href='User_blog.asp?Action=UnLock&ID=" & rs("ID") & "'>通過(guò)審核</a> "
end if
end if
if userlevel=9 then
if rs("isbest")="true" then
response.write "<a href='User_blog.asp?Action=unisbest&ID=" & rs("ID") & "'>取消推薦</a> "
else
response.write "<a href='User_blog.asp?Action=isbest&ID=" & rs("ID") & "'>設(shè)為推薦</a> "
end if
end if
response.write "<a href='User_blog.asp?Action=Del&ID=" & rs("ID") & "&username="&rs("username")&"' onClick='return confirm(""確定要?jiǎng)h除此日志嗎?"");'>刪除</a>"
%> </td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
選中本頁(yè)顯示的所有日志</td>
<td> <strong>操作:</strong>
<input name="Action" type="radio" value="Del" checked onClick="document.myform.UserLevel.disabled=true">刪除
<% if userlevel=9 then %>
<input name="Action" type="radio" value="Lock" onClick="document.myform.UserLevel.disabled=true">
設(shè)為未審核
<input name="Action" type="radio" value="UnLock" onClick="document.myform.UserLevel.disabled=true">
通過(guò)審核 <%end if%>
<input type="submit" name="Submit" value=" 執(zhí) 行 "></td>
</tr>
</table>
</td>
</form></tr></table>
<%
end sub
sub ShowSearch()
%>
<form name="form2" method="post" action="User_blog.asp">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr class="tdbg">
<td width="120"><strong>日志高級(jí)查詢:</strong></td>
<td width="300">
<select name="Field" id="Field">
<option value="ID">日志ID</option>
<option value="topic" selected>日志標(biāo)題</option>
</select>
<input name="Keyword" type="text" id="Keyword" size="20" maxlength="30">
<input type="submit" name="Submit2" value=" 查 詢 ">
<input name="UserSearch" type="hidden" id="UserSearch" value="10">
</td>
<td>若為空,則查詢所有日志</td>
</tr>
</table>
</form>
<%
end sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -