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

📄 process_add.asp

📁 Simple涂乌板2
💻 ASP
字号:
<!-- #include file="inc/conn.asp" -->
<!-- #include file="inc/config.asp" -->
<!-- #include file="inc/function.asp" -->
<%
If Session("visitor")=Empty Then
	Response.Redirect "message.asp?action=rewrite&message=非法登陆,禁止访问"
End If

If IsOpened="False" Then
	Response.Redirect "message.asp?action=rewrite&message=很抱歉,留言簿已经设置为不对外开放,现在暂时不可以留言!"
End If

tbname="record"

ID=SafeRequest("ID")
mode=SafeRequest("mode")
quote=trim(SafeRequest("quote"))
theme=trim(SafeRequest("theme"))
name=trim(SafeRequest("name"))
note=SafeRequest("note")
image=SafeRequest("image")
face=SafeRequest("face")
mood=trim(SafeRequest("mood"))
weather=SafeRequest("weather")
webtype=trim(SafeRequest("webtype"))
webaddr=trim(SafeRequest("webaddr"))
qq=trim(SafeRequest("qq"))
email=trim(SafeRequest("email"))
homepage=trim(SafeRequest("homepage"))
phone=trim(SafeRequest("phone"))

'错误处理
If quote="" And mode=5 Then
	Response.Redirect "message.asp?action=rewrite&message=引用语句(Quote)不能为空,请重填"
ElseIf Len(quote)>255 Then
	Response.Redirect "message.asp?action=rewrite&message=引用语句(Quote)最多为255个字符,请重填"
End If

If theme="" And mode=3 Then
	Response.Redirect "message.asp?action=rewrite&message=主题名称(Theme)不能为空,请重填"
ElseIf GetStrLen(theme)<10 And mode=3 Then
	Response.Redirect "message.asp?action=rewrite&message=主题名称(Theme)太短,至少要5个中文字符,请重填"
End If

If note="" Then
	Response.Redirect "message.asp?action=rewrite&message=留言(Note)不能为空,请重填"
ElseIf GetStrLen(note)>MaxNote Then
	Response.Redirect "message.asp?action=rewrite&message=留言字数(Note)最多为"&MaxNote/2&"个中文字,请重填"
End If

If webtype<>"" And webaddr="" Then
	Response.Redirect "message.asp?action=rewrite&message=你选择了填写推荐项(Link),请在填写下面的链结地址(Addr)"
End If

If Not IsNumeric(face) Then
	face=1
End If

If Not IsNumeric(weather) Then
	weather=1
End If

IP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If IP = "" Then IP = Request.ServerVariables("REMOTE_ADDR") 

'处理万一是重复提交的留言
sql0="select ID,name,note from "&tbname&" where ID = (select MAX(ID) from record)"
set rs0=GetRS(mdbname,tbname,sql0)
If rs0("name")=name And rs0("note")=note Then
	Response.Redirect "message.asp?action=rewrite&message=你已经发表了该留言,不能重复发表,请按后退键退出签写留言的页面"
End If
rs0.Close
Set rs0=Nothing

'一般留言
If mode="0" Then
	dbtype=0
	sql1="select * from "&tbname
	set rs1=GetRS(mdbname,tbname,sql1)
	rs1.AddNew array("name","note","image","face","mood","weather","webtype","webaddr","IP","qq","homepage","email","phone"),array(name,note,image,face,mood,weather,webtype,webaddr,IP,qq,homepage,email,phone)
	rs1.Close
	Set rs1=Nothing
Else
	sql2="select * from "&tbname&" where ID="&ID
	set rs2=GetRS(mdbname,tbname,sql2)

	'回复留言
	If mode="4"	Then
		dbtype=rs2("dbtype")
		themeNo=rs2("themeNo")
		replytime=rs2("time")
		reply=rs2("name")
	End If

	'引用留言
	If mode="5" Then
		dbtype=rs2("dbtype")
		themeNo=rs2("themeNo")
		reply=rs2("name")
		quote=quote
	End If

	'回复主题
	If mode="6" Then
		dbtype=rs2("dbtype")
		themeNo=rs2("themeNo")
	End If

	'发表新主题
	If mode="3" Then
		sql3="select max(themeNo) from "&tbname&" where dbtype="&rs2("dbtype")
		set rs3=GetRS(mdbname,tbname,sql3)
		rs3row=rs3.GetRows
		themeName=theme
		themeNo=rs3row(0,0)
		'处理隐藏帖存在时的特别情况
			sql4="select max(themeNo) from "&tbname&" where themeNo<3000 and dbtype="&rs2("dbtype")
			set rs4=GetRS(mdbname,tbname,sql4)
			rs4row=rs4.GetRows
			If themeNo>3000 then
				themeNo=themeNo-3000
			End If
			If themeNo<rs4row(0,0) Then
				themeNo=rs4row(0,0)
			End If
			rs4.Close
			Set rs4=Nothing
		themeNo=themeNo+1
		dbtype=rs2("dbtype")
		'处理当帖子为默认帖的时候,把它删除
		If themeNo=2 Then
			sql3_1="select * from "&tbname&" where dbtype="&rs2("dbtype")&" and themeNo=1"
			set rs3_1=GetRS(mdbname,tbname,sql3_1)
			rs3_1.Delete
		End If
		rs3.Close
		Set rs3=Nothing
		'赋默认值给主题的回复次数,最后回复人和最后回复时间
		reply=name
		quote=0
		replytime=Now()
	End If

rs2.AddNew array("name","note","image","face","mood","weather","webtype","webaddr","IP","qq","email","homepage","phone","reply","quote","replytime","dbtype","themeNo","themeName"),array(name,note,image,face,mood,weather,webtype,webaddr,IP,qq,email,homepage,phone,reply,quote,replytime,dbtype,themeNo,themeName)
rs2.Close
Set rs2=Nothing

	'处理回复主题时的回复次数,最后回复人和最后回复时间
	If dbtype<>0 And themeNo<>0 Then
		sql4="select reply,quote,replytime from "&tbname&" where dbtype="&dbtype&" and themeNo="&themeNo&" And themeName<>Null"
		set rs4=GetRS(mdbname,tbname,sql4)
		rs4("reply")=name
		rs4("quote")=rs4("quote")+1
		rs4("replytime")=Now()
		rs4.Update
		rs4.Close
		Set rs4=Nothing
	End If
End If
If themeNo<>0 And dbtype<>0 Then
	Response.Redirect "message.asp?message=留言成功!你使用的是Simple涂乌板2试用版,请尽快升级为标准版,升级方法请留意管理台的“注册登陆”一栏。请点击Confirm查看留言&action=tryout_confirm&block="&dbtype&"&theme="&themeNo
Else
	Response.Redirect "message.asp?message=留言成功!你使用的是Simple涂乌板2试用版,请尽快升级为标准版,升级方法请留意管理台的“注册登陆”一栏。请点击Confirm查看留言&action=tryout_confirm"
End If
%>

⌨️ 快捷键说明

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