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

📄 save.asp

📁 同样是一个在ASP.NET+SQL基础环境下开发的网上BBS系统
💻 ASP
字号:
<!--#include file="conn.inc"-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存文章</title>
<style type="text/css">
<!--
	a:visited,a:link  {  text-decoration: none; color: #003399}
	a:hover {  text-decoration: none; color: #3333FF}
	a.linkwhite:link,a.linkwhite:visited { text-decoration:none; color:white}
	a.linkwhite:hover { text-decoration: underline; color:white}
	a.linkblack:link,a.linkblack:visited { text-decoration:none; color:black}
	a.linkblack:hover { text-decoration: underline; color:black}
	input { font-family: "宋体"; font-size: 9pt}
	td {  font-family: "宋体"; font-size: 9pt; color: #000000}
	.en {  font-family:"Verdana", "Arial"; font-size: 9pt}
	.white {  color: #FFFFFF}
	.line {  line-height: 20px}
	.title { font-size: 14px }
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<%
Check Request("SerialNum")

If Request("Theme")="" Then
If Request("parentid")="" then
argu=""
Else
argu="?parentid=" & Request("parentid")
End If
%>

<form method="POST" action="save.asp<%=argu%>">
  <p><strong><font size="3" color=vbwhite>发表新文章</font></strong></p>
  <p><b><font size="2" color=vbwhite>请输入文章主题:<input type="text" name="Theme" size="38"
  style="background-color: rgb(192,192,192); color: rgb(128,0,0)">
  </font></b></p>
  <p><b><font size="2" color=vbwhite>请输入文章内容:<br>
  </font><textarea rows="20" name="Content" cols="50"
  style="background-color: rgb(192,192,192); color: rgb(128,0,0)"><%=Request("Content")%></textarea></b></p>
  <p><input type="submit" value="发表" name="B1"><input type="reset" value="取消"
  name="B2"></p>
  <input type="hidden" name="SerialNum" value="<%=Request("SerialNum")%>">
</form>
<%
Response.End
End If%>
<%
sql="SELECT * FROM ever_user WHERE UID IN ("
sql=sql & "SELECT UID FROM current_user WHERE SerialNum='" & Request("SerialNum") & "')"
Set  Save_Rs=conn.Execute(sql)
If Save_Rs.Eof OR Save_Rs.Bof Then
Response.Write "<font color=purple size=5 >你还没有注册过,请选注册新用户进入!</font>.<br>"
Response.End
Else
If IsNull(Save_Rs("Essay")) Then
Essay=0
Else
Essay=Save_Rs("Essay")
End If
Essay=Essay+1
sql="UPDATE ever_user SET Essay=" & Essay & " WHERE UID='" & Save_Rs("UID") & "'"
conn.Execute(sql)
End If

UID=DealInput(Save_Rs("UID"))
Email=DealInput(Save_Rs("Email"))
Theme=DealInput(Request("Theme"))
DateAndtime=Now()
Length=len(Request("Content"))
HomePage=DealInput(Save_Rs("HomePage"))
Content=DealInput(Request("Content"))

'插入数据
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
'使用对象

cmdTemp.CommandText = "SELECT * FROM details WHERE (UID IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor.AddNew
InsertCursor("Levels")=1
InsertCursor("child")="0"
InsertCursor("UID")=UID
InsertCursor("Email")=Email
InsertCursor("Theme")=Theme
InsertCursor("DateAndTime")=DateAndTime
InsertCursor("VisitTimes")=0
InsertCursor("Length")=Length
InsertCursor("HomePage")=HomePage
InsertCursor("Content")=Content
InsertCursor.Update
cuid=InsertCursor("Num")
InsertCursor.close
'往表details中插入记录

cmdTemp.CommandText = "SELECT * FROM new_essay WHERE (UID IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor.AddNew
InsertCursor("UID")=UID
InsertCursor("Theme")=Theme
InsertCursor("IssueTime")=DateAndTime
InsertCursor("FileId")=cuid
InsertCursor.Update
InsertCursor.close
'往表new_essay中插入记录


parentid=Request("parentid")

If parentid<>"" then
sql="SELECT * FROM details WHERE Num=" & parentid
dim rootRs
Set rootRs=conn.Execute(sql)
on Error resume next
rootRs.movefirst
child=rootRs("child")
Levels=rootRs("Levels")+1
'child="0"
child=child & "," & Cstr(cuid)
'准备更新数据

sql="UPDATE details SET Child='" & child & "' WHERE Num="& parentid
conn.Execute (sql)
sql="UPDATE details SET Levels=" & Levels  &" WHERE Num="& cuid
conn.Execute (sql)
'更新数据
End If
%>

<p><a href="list.asp?SerialNum=<%=Request("SerialNum")%>"
target="left"><b><font face="华文行楷" size="2">及时刷新</font></b> </a></p>
</body>
</html>

⌨️ 快捷键说明

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