📄 add.asp
字号:
<%
if session("user_type")<>"T" then
response.redirect "../../../index.asp"
end if
%>
<!--#INCLUDE FILE="../../../system/odbc_connection.asp"-->
<!--#Include file="function.asp"-->
<%
Dim body,father,hits,user_id '声明变量方便使用
title=myReplace(Request.Form("title")) '返回文章标题
body=myReplace(Request.Form("body")) '返回文章内容
user_id=myReplace(Request.Form("user_id")) '返回作者姓名
email=myReplace(Request.Form("email")) '返回作者email
hits=0 '点击数为0
forumid=Session("forumid") '论坛编号
'以下将文章保存到数据库
Dim sqla,sqlb,strSql
sqla = "Insert Into bbs(title,hits,user_id,submit_date,forumid"
sqlb = "Values('" & title & "'," & hits & ",'" & user_id & "',#" & Now() & "#," & forumid
If body<>"" Then '如果文章内容不为空,则添加内容
sqla = sqla & ",body"
sqlb = sqlb & ",'" & body & "'"
End If
If email<>"" Then '如果有email,则添加
sqla = sqla & ",email"
sqlb = sqlb & ",'" & email & "'"
End If
strSql = sqla & ") " & sqlb & ")"
db.Execute(strSql)
'下面首先获取该文章的父编号
Dim rs
strSql="Select Top 1 id From bbs Where title='" & title & "' And user_id='" & user_id & "' Order By id desc"
Set rs=db.Execute(strSql)
'下面将该文章的父编号替换
strSql="Update bbs Set father='" & GetFatherCode(rs("id")) & "' Where title='" & title & "' And user_id='" & user_id & "'"
Response.Write "<p>" & StrSql
db.Execute(strSql)
'下面两句将原文章的回复数加1
strSql="update bbs_forum set forumcount=forumcount+1 where ID = " & forumid
db.Execute(strSql)
db.Close
'重定向回首页
Response.Redirect "bbslist.asp"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -