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

📄 user_blog.asp

📁 博客模块:Blog是继Email、BBS、ICQ后的第四种网络交流方式
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#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.theForm.topic.value);
     if (topic.length == 0)
     {
        alert("您忘了填写题目!");
	return false;
     }
	 
	 var needclassid=<%=needclassid%>
	 if (needclassid==true) {
	 if (document.theForm.classid.value == 0)
     {
        alert("请选择日志的类别!");
	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("请输入正确的显示字数!");
	  return false;  
		 }
     }
	if (document.theForm.edit.value == "")
     {
        alert("请输入日志内容!");
	return false;
     }	
	var date=document.theForm.selecty.value+"-"+document.theForm.selectm.value+"-"+document.theForm.selectd.value
	var datereg=/^(\d{4})-(\d{1,2})-(\d{1,2})$/
	var datareg=/^(\d){1,2}$/
	if (!datereg.test(date)){
	  alert("日志时间输入格式错误");
	   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("日志时间输入格式错误");
	   return false;
	 }
	
  var FormLimit = 51100
  var TempVar = new String
  TempVar = document.theForm.edit.value
  if (TempVar.length > FormLimit)
	{
	if (confirm("您要发布的日志太长,建议您拆分为几部分分别发布。\n如果您坚持提交,注意需要较长时间才能提交成功。\n\n是否坚持提交?") == false)
	return false;
	}
	
	  if (TempVar.length > FormLimit)
  {
    document.theForm.edit.value = TempVar.substr(0, FormLimit)
    TempVar = TempVar.substr(FormLimit)
    while (TempVar.length > 0)
    {
      var objTEXTAREA = document.createElement("hidden")
      objTEXTAREA.name = "logtext"
      objTEXTAREA.value = TempVar.substr(0, FormLimit)
      document.theForm.appendChild(objTEXTAREA)
      
      TempVar = TempVar.substr(FormLimit)
    }
  }
	 
	 
	return true;
}

function setSort(s1,s2)
{
param=s1.selectedIndex-1;
if(param>=0)
	{
	s2.options.length=0;						
		for(i=0;i<p_array[param].length;i++)
		{
			s2.options.length++;
			s2.options[i].text=p_array[param][i];
			s2.options[i].value=p_array_id[param][i];
		}

	}else
	{
	s2.options.length=0;
	s2.options.length++;
	s2.options[0].text="我的专题";
	s2.options[0].value="0";
	}
}
</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
dim selectsub
keyword=trim(request("keyword"))
if keyword<>"" then 
	keyword=ReplaceBadChar(keyword)
end if
strField=trim(request("Field"))
UserSearch=trim(request("UserSearch"))
selectsub=trim(request("selectsub"))
Action=trim(request("Action"))
ID=ReplaceBadChar(trim(Request("ID")))
uname=ReplaceBadChar(trim(Request("uname")))
ComeUrl=Request.ServerVariables("HTTP_REFERER")
strFileName="user_blog.asp"
if UserSearch="" then
	UserSearch=0
else
	UserSearch=Clng(UserSearch)
	strFileName="user_blog.asp?UserSearch=" & UserSearch
end if
if selectsub<>"" then
	selectsub=Clng(selectsub)
	strFileName="user_blog.asp?UserSearch=10&selectsub="&selectsub
else
	selectsub=0
end if
if keyword<>"" then
	strFileName="user_blog.asp?UserSearch=10&keyword="&Keyword&"&strField="&strField
end if
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 bgcolor="#9900FF"> 
    <td height="22" colspan=3 align=center><span class="style1"><strong>用 户 日 志 管 理</strong></span></td>
  </tr>
  <form name="form1" action="User_blog.asp" method="get">
    <tr class="tdbg"> 
      <td width="34%" height="30"><strong>快速查找日志:</strong> <select size=1 name="UserSearch" onChange="javascript:submit()">
          <option value="10" selected>请选择查找类型</option>
		  <option value="0">列出所有日志</option>
          <option value="1">未通过审核的日志</option>
          <option value="2">已通过审核的日志</option>
          <option value="3">推荐日志</option>
          <%if userlevel=9 then%>
          <option value="4">我的日志</option>
          <%end if%>
        </select> &nbsp;&nbsp;&nbsp;</td>
      <td width="29%"> <strong>按专题查找:</strong>&nbsp;<a href="User_blog.asp"> 
        <select name="selectsub" id="selectsub" onChange="javascript:submit()">
          <%
			  response.Write "<option value=''>请选择专题</option>"
			  dim srs
			  set srs=conn.execute("select id,subjectname from subject where username='"&username&"'")
			  while not srs.eof
			  response.Write "<option value="&srs(0)&">"&srs(1)&"</option>"
			  srs.movenext
			  wend
			  %>
        </select>
        </a></td>
      <td width="37%"><div align="center"><a href="User_blog.asp"> 日志管理首页</a>&nbsp;|&nbsp;<a href="User_addblog.asp">添加新日志</a></div></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()
elseif Action="Move" then
	call moveblog()
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'>您现在的位置:<a href='User_blog.asp'>用户日志管理</a>&nbsp;&gt;&gt;&nbsp;"
	select case UserSearch
		case 0
			if userlevel=9 then
				sql="select top 1000 * from [blog] order by addtime desc"
			else
				sql="select * from [blog] where username='"&username&"' or author='"&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&"' or author='"&username&"' order by addtime desc"
			end if
			strGuide=strGuide & "未通过审核日志"
		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&"' or author='"&username&"' order by addtime desc"
			end if
			strGuide=strGuide & "已通过审核日志"
		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&"' or author='"&username&"' order by addtime desc"
			end if
			strGuide=strGuide & "推荐日志"
		case 4
			sql="select * from [blog] where username='"&username&"' or author='"&username&"' order by addtime desc"
			strGuide=strGuide & "我的日志"
		case 10
			if Keyword="" then
				if selectsub>0 then
					sql="select * from [blog] where (username='"&username&"' or author='"&username&"') and subjectid="&selectsub&" order by addtime desc"
					strGuide=strGuide & "专题id为"&selectsub&"的日志"
				else
					if userlevel=9 then 
						sql="select * from [blog] order by addtime desc"
					else
						sql="select * from [blog] where username='"&username&"' or author='"&username&"' order by addtime desc"
					end if
					strGuide=strGuide & "所有日志"
				end if
			else
				select case strField
				case "ID"
					if IsNumeric(Keyword)=False then
						FoundErr=True
						ErrMsg=ErrMsg & "<br><li>ID必须是整数!</li>"
					else
						if userlevel=9 then 
							sql="select * from [blog] where ID =" & Clng(Keyword)
						else
							sql="select * from [blog] where ID =" & Clng(Keyword)&" and (username='"&username&"' or author='"&username&"')"
						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&"' or author='"&username&"' order by addtime desc"
					end if
					strGuide=strGuide & "标题中含有“ <font color=red>" & Keyword & "</font> ”的日志"
				end select
			end if
		case else
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>错误的参数!</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> 个日志</td></tr></table>"
		response.write strGuide
	else
    	totalPut=rs.recordcount
		strGuide=strGuide & "共找到 <font color=red>" & totalPut & "</font> 个日志</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,"个日志"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then

⌨️ 快捷键说明

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