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

📄 process.asp

📁 Simple涂乌板2
💻 ASP
字号:
<!-- #include file="inc/conn.asp" -->
<!-- #include file="inc/config.asp" -->
<!-- #include file="inc/md5.asp" -->
<%
action=SafeRequest("action")

If action="WenTi" Then
	DaAn=SafeRequest("DaAn")
	If DaAn<>LoginAnswer Then
		Response.Redirect "index.asp?result=fail"
	Else
		Session("FuncLoginPass")="Pass"
		Response.Redirect "page.asp"
	End If
End If

If Session("manager")=Empty Then
		Response.Redirect "message.asp?action=rewrite&message=你没有正常登陆,请重登陆"
End If

'基本设置
If action="interface" Then
	PageSize=SafeRequest("PageSize")
	ThemePageSize=SafeRequest("ThemePageSize")
	ThemeOnlyPageSize=SafeRequest("ThemeOnlyPageSize")
	MaxNote=SafeRequest("MaxNote")
	Upload=SafeRequest("Upload")
	ThemeListMode=SafeRequest("ThemeListMode")
	css=SafeRequest("css")
	LOGOPath=SafeRequest("LOGOPath")
	SiteName=SafeRequest("SiteName")
	Bulletin=SafeRequest("Bulletin")
	IsOpened=SafeRequest("IsOpened")

	If PageSize<10 Or PageSize>30 Then
		Response.Redirect "message.asp?action=rewrite&message=留言每页帖子数超出范围,最小为10最大为30"
	End If
	If ThemePageSize<10 Or ThemePageSize>50 Then
		Response.Redirect "message.asp?action=rewrite&message=主题每页帖子数超出范围,最小为10最大为50"
	End If
	If ThemeOnlyPageSize<8 Or ThemeOnlyPageSize>20 Then
		Response.Redirect "message.asp?action=rewrite&message=主题区帖子数超出范围,最小为8最大为20"
	End If
	If MaxNote<1000 Or MaxNote>5000 Then
		Response.Redirect "message.asp?action=rewrite&message=最大留言字数超出范围,最小为1000最大为5000"
	End If
	If Not (ThemeListMode=1 Or ThemeListMode=2 Or ThemeListMode=3) Then
		Response.Redirect "message.asp?action=rewrite&message=主题列表顺序超出范围,值应该为1,2,3"
	End If
	If css="" Then
		Response.Redirect "message.asp?action=rewrite&message=请输入主题样式名称,是Theme目录下的目录名称"
	End If
	If SiteName="" Then
		Response.Redirect "message.asp?action=rewrite&message=请输入SiteName(站点名称)"
	End If

	st("css")=css
	st("ThemePageSize")=ThemePageSize
	st("ThemeOnlyPageSize")=ThemeOnlyPageSize
	st("PageSize")=PageSize
	st("MaxNote")=MaxNote*2
	st("Upload")=Upload
	st("ThemeListMode")=ThemeListMode
	st("LOGOPath")=LOGOPath
	st("SiteName")=SiteName
	st("Bulletin")=Bulletin
	st("IsOpened")=IsOpened
	
	st.Update
	st.Close
	set st=Nothing
	Response.Redirect "manage.asp"
'新建版块
ElseIf action="newblock" Then
	block_name=SafeRequest("block_name")
	block_intro=SafeRequest("block_intro")
	block_manager=SafeRequest("block_manager")
	block_image=SafeRequest("block_image")
	block_UserAction=SafeRequest("block_UserAction")
	tbname="record"
	sql_count_block="select count(dbtype) from (select dbtype from "&tbname&" group by dbtype)"
	set count_block_rs=GetRS(mdbname,tbname,sql_count_block)
	count_block_row=count_block_rs.GetRows
	If count_block_row(0,0)>=3 Then
		Response.Redirect "message.asp?action=rewrite&message=你的Simple涂乌板2的版本是试用版,版块数不能超过两个,若要增加版块,请升级你的Simple涂乌板2为标准版"
	End If

	If block_name="" Or block_intro="" Or block_manager="" Or (Not IsNumeric(block_image)) Then
		Response.Redirect "message.asp?action=rewrite&message=请把表填写完整,版块的图标只能是数字"
	End If

	tbname="record"
	sql_max_block="select max(dbtype) from "&tbname
	set max_block_rs=GetRS(mdbname,tbname,sql_max_block)
	max_block_row=max_block_rs.GetRows
	dbtype=max_block_row(0,0)+1

	sql_block="select name,image,note,mood,themeName,dbtype,themeNO,reply from "&tbname
	set block_rs=GetRS(mdbname,tbname,sql_block)

	block_rs.AddNew array("name","image","mood","themeName","dbtype","themeNO","reply"),array(block_name,block_image,block_intro,block_manager,dbtype,0,block_UserAction)
	block_rs.AddNew array("name","image","note","mood","themeName","dbtype","themeNO"),array("系统公告",1,"请发布新主题,此主题会在你发布的新主题的同时自动删除","","此版块暂时没有主题",dbtype,1)
	max_block_rs.Close
	block_rs.Close
	set max_block_rs=Nothing
	set block_rs=Nothing
	Response.Redirect "manage.asp?action=alterblock"
'修改版块
ElseIf action="alterblock" Then
	block_name=SafeRequest("block_name")
	block_intro=SafeRequest("block_intro")
	block_manager=SafeRequest("block_manager")
	block_image=SafeRequest("block_image")
	block_UserAction=SafeRequest("block_UserAction")
	dbtype=SafeRequest("dbtype")

	If block_name="" Or block_intro="" Or block_manager="" Or (Not IsNumeric(block_image)) Then
		Response.Redirect "message.asp?action=rewrite&message=请把表填写完整,版块的图标只能是数字"
	End If

	tbname="record"
	sql_block="select name,image,mood,themeName,reply from "&tbname&" where dbtype="&dbtype&" and themeNo=0"
	set block_rs=GetRS(mdbname,tbname,sql_block)

	block_rs("name")=block_name
	block_rs("image")=block_image
	block_rs("mood")=block_intro
	block_rs("themeName")=block_manager
	block_rs("reply")=block_UserAction
	block_rs.Update
	block_rs.Close
	set block_rs=Nothing
	Response.Redirect "manage.asp?action=alterblock"
'删除版块
ElseIf action="deleteblock" Then
	dbtype=SafeRequest("dbtype")
	tbname="record"
	confirm=SafeRequest("confirm")

	If confirm="" Then
		Response.Redirect "message.asp?dbtype="&dbtype&"&action=deleteblock_confirm&message=你正准备删除版块"&dbtype&",这样在这个版块下的主题都会全部删除的,请确认?"
	End If

	If dbtype=2 Then
		Response.Redirect "message.asp?action=tryout_confirm&message=你的Simple涂乌板2是试用版,删除此版块是被禁止的!若要解除此限制,请升级为标准版!"
	End If

	'查询版块数是否等于1,是的阻止
	sql_block_count="select count(dbtype) as block_count from (select dbtype from "&tbname&" where dbtype<>0 group by dbtype)"
	set block_count=GetRS(mdbname,tbname,sql_block_count)
	If block_count("block_count")=1 Then
		Response.Redirect "message.asp?action=rewrite&message=版块数至少为1,不能删除!"
	End If
	
	sql_block="select ID from "&tbname&" where dbtype="&dbtype
	set block_rs=GetRS(mdbname,tbname,sql_block)
	
	block_rs.MoveFirst
	For n=1 to block_rs.RecordCount
		block_rs.Delete
		If block_rs.EOF Then Exit For
		block_rs.MoveNext
	Next
	block_rs.Close
	set block_rs=Nothing
	Response.Redirect "page.asp"
'删除记录
ElseIf action="deleterecord" Then
	ID=SafeRequest("ID")
	confirm=SafeRequest("confirm")

	tbname="record"
	sql="select name,dbtype,themeNo,themeName from "&tbname&" where ID="&ID
	set rs=GetRS(mdbname,tbname,sql)

	'删除的是主题时
	If rs("themeName")<>"" Then
		If confirm="" Then
			Response.Redirect "message.asp?ID="&ID&"&action=deleterecord_confirm&message=连同该主题的回复也一起删除,你确认要删除该主题吗?"
		End If
		
		'当主题只剩一条时不能删除
		sql_theme="select themeNo from "&tbname&" where dbtype="&rs("dbtype")&" and themeNo<>0 group by themeNo"
		set theme_rs=GetRS(mdbname,tbname,sql_theme)
		If theme_rs.RecordCount=1 Then
			Response.Redirect "message.asp?action=rewrite&message=当主题只剩一条时不能删除"
		End If
		
		sql_del_theme="select ID from "&tbname&" where dbtype="&rs("dbtype")&" and themeNo="&rs("themeNo")
		set del_theme_rs=GetRS(mdbname,tbname,sql_del_theme)
		del_theme_rs.MoveFirst
		For n=1 to del_theme_rs.RecordCount
			del_theme_rs.Delete
			If del_theme_rs.EOF Then Exit For
			del_theme_rs.MoveNext
		Next
		del_theme_rs.Close
		set del_theme_rs=Nothing
	'删除的是留言时
	Else
		If confirm="" Then
			Response.Redirect "message.asp?ID="&ID&"&action=deleterecord_confirm&message=你确认要删除该记录吗?"
		End If
		If ID<=574 Then
			Response.Redirect "message.asp?action=tryout_confirm&message=你的Simple涂乌板2是试用版,此留言不能删除!如果想解除次限制,请升级为标准版!"
		End If
		'当留言只剩一条时不能删除
		sql_check="select ID from "&tbname&" where dbtype=0"
		set check_rs=GetRS(mdbname,tbname,sql_check)
		If check_rs.RecordCount=1 Then
			Response.Redirect "message.asp?action=rewrite&message=当留言只剩一条时不能删除"
		End If
		'删除主题的留言时处理的回复次数,最后回复人和最后回复时间
		If rs("dbtype")<>0 And rs("themeNo")<>0 Then
			sql4="select ID,name,time,reply,quote,replytime from "&tbname&" where dbtype="&rs("dbtype")&" and themeNo="&rs("themeNo")&" order by time"
			set rs4=GetRS(mdbname,tbname,sql4)
			rs4.MoveLast
			'如果删除的是最近的回复,处理
			If Int(rs4("ID"))=Int(ID) Then
				rs4.MovePrevious
				reply=rs4("name")
				replytime=rs4("time")
				rs4.MoveFirst
				rs4("reply")=reply
				rs4("replytime")=replytime
			End If
			rs4.MoveFirst
			rs4("quote")=rs4("quote")-1
			rs4.Update
			rs4.Close
			Set rs4=Nothing
		End If
		rs.Delete
		rs.Close
		set rs=Nothing
	End If
	Response.Redirect "page.asp"
'设置隐藏
ElseIf action="set-hidden" Then
	block=SafeRequest("block")
	theme=SafeRequest("theme")
	tbname="record"
	'当主题只剩一条时不能隐藏
	tbname="record"
	sql_theme="select themeNo from "&tbname&" where dbtype="&block&" and themeNo<>0 group by themeNo"
	set theme_rs=GetRS(mdbname,tbname,sql_theme)
	If theme_rs.RecordCount=1 Then
		Response.Redirect "message.asp?action=rewrite&message=当主题只剩一条时不能隐藏"
	End If

	sql="select dbtype,themeNo from "&tbname&" where dbtype="&block&" and themeNo="&theme
	set rs=GetRS(mdbname,tbname,sql)
	If rs("themeNo")>0 And rs("themeNo")<3000 Then
		rs.MoveFirst
		For n=1 to rs.RecordCount
			rs("themeNo")=rs("themeNo")+3000
			If rs.EOF Then Exit For
			rs.MoveNext
		Next
		rs.Close
		set rs=Nothing
	End If
	Response.Redirect "page.asp"
''撤销隐藏
ElseIf action="cancel-hidden" Then
	block=SafeRequest("block")
	theme=SafeRequest("theme")
	tbname="record"
	
	sql="select dbtype,themeNo from "&tbname&" where dbtype="&block&" and themeNo="&theme
	set rs=GetRS(mdbname,tbname,sql)
	If rs("themeNo")>3000 And rs("themeNo")<6000 Then
		rs.MoveFirst
		For n=1 to rs.RecordCount
			rs("themeNo")=rs("themeNo")-3000
			If rs.EOF Then Exit For
			rs.MoveNext
		Next
		rs.Close
		set rs=Nothing
	End If
	Response.Redirect "page.asp"
'更改管理员密码
ElseIf action="altermanager" Then
	admin=SafeRequest("admin")
	password=SafeRequest("password")

	If admin="" Or password="" Then
	Response.Redirect "message.asp?action=rewrite&message=管理员和密码都不能为空"
	End If

	tbname="manage"
	sql="select admin,password from "&tbname
	set mg=GetRS(mdbname,tbname,sql)
	mg("admin")=md5(admin)
	mg("password")=md5(password)
	mg.Update
	mg.Close
	Set mg=Nothing
	Response.Redirect "manage.asp?action=altermanager"
'注销登陆
ElseIf action="logout" Then
	Session.Contents.Remove("manager")
	Response.Redirect "page.asp"
'IP过滤
ElseIf action="AddIPFilter" Then
	Name=SafeRequest("Name")
	IP=SafeRequest("IP")
	
	If Len(Name)>10 Or Name="" Then
		Response.Redirect "message.asp?action=rewrite&message=名字不能为空,名字数不能超出范围,最大为10"
	End If
	If Len(IP)>16 Or IP="" Then
		Response.Redirect "message.asp?action=rewrite&message=IP不能为空,IP字数不能超出范围,最大为16"
	End If
	tbname="IPFilter"
	sql="select * from "&tbname
	set FT=GetRS(mdbname,tbname,sql)
	FT.AddNew Array("Name","IP"),Array(Name,IP)
	FT.Close
	Response.Redirect "manage.asp?action=IPFilter"
ElseIf action="DelIPFilter" Then
	ID=SafeRequest("ID")
	tbname="IPFilter"
	sql="select * from "&tbname&" Where ID="&ID
	set FT=GetRS(mdbname,tbname,sql)
	FT.Delete
	Response.Redirect "manage.asp?action=IPFilter"
ElseIf action="loginquestion" Then
	LoginQuestion=SafeRequest("LoginQuestion")
	LoginAnswer=SafeRequest("LoginAnswer")
	st("LoginQuestion")=LoginQuestion
	st("LoginAnswer")=LoginAnswer
	st.Update
	Response.Redirect "manage.asp?action=loginquestion"
End If
%>

⌨️ 快捷键说明

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