addnewtop.asp
来自「1. 硬件环境:MS WINDOWS NT PACK 4 OR LATER /W」· ASP 代码 · 共 440 行 · 第 1/2 页
ASP
440 行
<!--#include file ="setup.asp"-->
<!-- #include file="inc/ybbcode.asp" -->
<!-- #include file="inc/function.asp" -->
<%
Menu=Server.HTMLEncode(Trim(Request.QueryString("Menu")))
Quot=Trim(Request.QueryString("Quot"))
Quote=Trim(Request.QueryString("Quote"))
EditId=Request.QueryString("EditId")
Bbs=Request.QueryString("Bbs")
page=Request.QueryString("page")
if Len(Menu) > 10 Then Error 1,"参数非法传递!\n您的IP已被记录!",""
if Request.ServerVariables("request_method") = "POST" then
username=cstr(Request.Form("username"))
userpass=Trim(Request.Form("userpass"))
BbsId =Trim(Request.QueryString("BbsId"))
icon=Request.Form("icon")
topic=server.htmlencode(Trim(Request.Form("topic")))
content=server.htmlencode(Trim(Request.Form("content")))
content=replace(content,"'","'")
message=""
if Request.Form("htmlcode")<>"1" then content=replace(content,vbCrlf,"<br>")
if len(username)>20 Then Error 2,"产数非法传递!",""
if DateDiff("s",session("make"),Now()) < 10 Then Error 2,"为防止有人用程序灌水,本商务系统限制一个人两次发帖间隔必须大于10秒!",""
if username="" then message=message&"用户号码没有填写.\n"
if userpass="" then message=message&"密码没有填写.\n"
if topic="" and Menu<> "Rebbs" and Menu<> "EditRebbs" and Menu<> "Quikly" then message=message&"主题没有填写.\n"
if content="" then message=message&"内容没有填写.\n"
if Len(topic)>50 then message=message&"文章主题不能大于 50 字节.\n"
if Len(content)>50000 then message=message&"文章内容不能大于 50000 字节.\n"
if instr(topic,"ヴ") > 0 or instr(topic,"ヂ") > 0 or instr(topic,"ゼ") > 0 or instr(topic,"ヅ") > 0 then message=message&"主题中不能含有“ヴ ヂ ゼ ヅ”字符.\n"
if instr(content,"ヴ") > 0 or instr(content,"ヂ") > 0 or instr(content,"ゼ") or instr(content,"ヅ") > 0 then message=message&"内容中不能含有“ヴ ヂ ゼ ヅ”字符.\n"
if message<>"" then Error 2,"关于错误的原因!\n\n"&message,""
if icon = "" then
randomize
icon=Int((24*rnd)+1)
end if
badword=Split(conn.execute("Select FunctionInfo from Functions where FunctionID=6")(0),",")
for i=0 to ubound(badword)
topic=replace(topic,badword(i),"****")
content=replace(content,badword(i),"****")
next
if Request.Cookies("User")="" or Request.Cookies("password")="" Then userpass = Encrypt(userpass)
SqlStr="Select Count(UserID) From UserInfo where UserPsd = '"&userpass&"' and UserName_2 ='"&username&"'"
if Conn.Execute(SqlStr)(0)=0 Then
Error 2,"输入错误!",""
else
Response.Cookies("Username")=username
Response.Cookies("User")=Conn.Execute("Select UserID From UserInfo where UserPsd = '"&userpass&"' and UserName_2 ='"&username&"'")(0)
Response.Cookies("password")=userpass
Response.Cookies("Product")=1
End if
validate "Login.asp",0
%>
<!-- #include file="inc/ybbcode.asp" -->
<%
smilies(content)
if Request.Form("ybbcode")="" then
if ybbimg = "0" then
content=replace(content,"[IMG]","[URL]")
content=replace(content,"[/IMG]","[/URL]")
end if
if ybbflash = "0" then
content=replace(content,"[FLASH]","[URL]")
content=replace(content,"[/FLASH]","[/URL]")
end if
content = ybbcode(content)
end if
if Request.Form("htmlcode")="1" then content="<TEXTAREA cols=65 rows=6>"&content&"</TEXTAREA><br><INPUT onclick=runEx() type=button value=运行此代码>"
TName=Username
Username=Request.Cookies("User")
Select Case Menu
Case "Addnew"
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="Select BbsId,UserID,UserName,Title,Content,Content,Postip,Icon,LastTime,Restore,TopTopic,LockTopic,InIndex From Forum"
Rs.Open Sql,Conn,1,3
Rs.addnew
Rs("BbsId")=BbsId
Rs("UserID")=Username
Rs("UserName")=TName
Rs("Title")=topic
Rs("Content")=content
Rs("Postip")=Request.ServerVariables("remote_addr")
Rs("Icon")=icon
Rs("LastTime")=now
Rs("Restore")=TName
if Request.Form("TopTopic")=1 Then Rs("TopTopic")=1
if Request.Form("LockTopic")=1 Then Rs("LockTopic")=True
if Request.Form("InIndex")=1 Then Rs("InIndex")=True:Application(registered&"TheWord")=""
Rs.update
Rs.Close
Set Rs = Nothing
conn.execute("Update BbsInfo set AllTitle=AllTitle+1 where BbsId="&BbsId)
Conn.Close
Set Conn = Nothing
Response.redirect "BbsList.asp?Menu=List&BbsId="&BbsId&"&page="&page
Case "Rebbs"
if conn.execute("Select LockTopic from Forum where ShowID="&BbsId)(0)= True Then Error 2,"此主题暂不接受回复",""
LastName=conn.execute("Select UserName_2 from UserInfo where Userid="&Request.Cookies("User"))(0)
Conn.BeginTrans
Conn.Execute("insert into ReForum(TopID,Content,UsID,UserName,Postip)values("&BbsId&",'"&content&"',"&Username&",'"&TName&"','"&Request.ServerVariables("remote_addr")&"')")
Conn.Execute("Update BbsInfo set AllRe=AllRe+1 where BbsId="&Bbs)
Conn.Execute("Update Forum set AllPost=AllPost+1 where ShowID="&BbsId)
Conn.Execute("Update Forum set LastTime=now where ShowID="&BbsId)
Conn.Execute("Update Forum set Restore='"&LastName&"' where ShowID="&BbsId)
if Conn.Errors.Count <> 0 then
Error 2,"执行过程中有错误发生,请待网络恢复正常再重试!",""
Conn.RollbackTrans
Conn.Close
Set Conn = Nothing
response.End
else
conn.CommitTrans
end if
Conn.Close
Set Conn = Nothing
Response.redirect "BbsShow.asp?Menu=Show&BbsId="&BbsId&"&Bbs="&Bbs&"&page="&page
Case "EditRebbs"
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="Select UsID,Content,Postip From ReForum Where ReID="&EditId
Rs.Open Sql,conn,1,3
if Trim(Rs("UsID")) <> Trim(Request.Cookies("User")) and Request.Cookies("Product") < 5 Then Error 2,"无权限编辑!",""
if Rs.Eof Then Error 1,"系统不存在此贴子,可能已被管理员删除!\n对此带来的不便,我们深表歉意!",""
Rs("Content")=content
Rs("Postip")=Request.ServerVariables("remote_addr")
Rs.update
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
Response.redirect "BbsShow.asp?Menu=Show&BbsId="&BbsId&"&Bbs="&Bbs&"&page="&page
Case "EditBbs"
Set rs = Server.CreateObject("ADODB.Recordset")
Sql="Select UserID,Title,Content,Postip,Icon,LastTime,TopTopic,LockTopic,InIndex From Forum Where ShowID="&EditId
rs.Open Sql,conn,1,3
if Rs.Eof Then Error 1,"系统不存在此贴子,可能已被管理员删除!\n对此带来的不便,我们深表歉意!",""
if Trim(Rs("UserID")) <> Trim(Request.Cookies("User")) and Request.Cookies("Product") < 5 Then Error 2,"无权限编辑11!",""
Rs("Title")=topic
Rs("Content")=content
Rs("Postip")=Request.ServerVariables("remote_addr")
Rs("Icon")=icon
Rs("LastTime")=now
if Request.Form("TopTopic")=1 Then Rs("TopTopic")=1
if Request.Form("LockTopic")=1 Then Rs("LockTopic")=True
if Request.Form("InIndex")=1 Then Rs("InIndex")=True
Rs.update
Rs.Close : Conn.Close
Set Rs = Nothing : Set Conn = Nothing
Response.redirect "BbsShow.asp?Menu=Show&BbsId="&BbsId&"&Bbs="&Request.QueryString("Bbs")&"&page="&page
Case "Quikly"
if conn.execute("Select LockTopic from Forum where ShowID="&BbsId)(0) Then Error 2,"此主题暂不接受回复",""
LastName=conn.execute("Select UserName_2 from UserInfo where Userid="&Request.Cookies("User"))(0)
Conn.BeginTrans
Conn.Execute("insert into ReForum(TopID,Content,UsID,UserName,Postip)values("&BbsId&",'"&content&"',"&Username&",'"&TName&"','"&Request.ServerVariables("remote_addr")&"')")
Conn.execute("Update BbsInfo set AllRe=AllRe+1 where BbsId="&Bbs)
Conn.execute("Update Forum set AllPost=AllPost+1 where ShowID="&BbsId)
Conn.execute("Update Forum set LastTime=now where ShowID="&BbsId)
Conn.execute("Update Forum set Restore='"&LastName&"' where ShowID="&BbsId)
if Conn.Errors.Count <> 0 then
Error 2,"执行过程中有错误发生,请待网络恢复正常再重试!",""
Conn.RollbackTrans
Conn.Close:Set Conn = Nothing
response.End
else
conn.CommitTrans
end if
Conn.Close:Set Conn = Nothing
Response.redirect "BbsShow.asp?Menu=Show&BbsId="&BbsId&"&Bbs="&Bbs&"&page="&page
End Select
Conn.Close
Set Conn = Nothing
session("make")=now
Response.end
End if
Call Top
Call table()
Response.Write("<style><!-- TABLE{BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:1px}TD{BORDER-RIGHT:0px;BORDER-TOP:0px}--></style><br>")
validate "Login.asp",0
Select Case Menu
Case "Addnew"
Thean="发表新主题"
Case "Rebbs"
if Trim(conn.execute("Select LockTopic from Forum where ShowID="&Request.QueryString("BbsID"))(0))= True Then Error 2,"此主题暂不接受回复",""
Thean="回复主题"
Case "EditRebbs"
if Trim(conn.execute("Select UsID from ReForum where ReID="&EditId)(0)) <> Trim(Request.Cookies("User")) and Request.Cookies("Product") < 5 Then Error 2,"无权限编辑!",""
Thean="编辑回复"
Case "EditBbs"
if Trim(conn.execute("Select UserID From Forum where ShowID="&EditId)(0)) <> Trim(Request.Cookies("User")) and Request.Cookies("Product") < 5 Then Error 2,"无权限编辑!",""
Thean="编辑主题"
End Select%>
<center>
<br>
<TABLE borderColor="#a4b6d7" cellSpacing=0 cellPadding=6 width=100% border=1 style="border-left: 0px none; border-top: 0px none; border-bottom: 1px none; border-collapse:collapse">
<form method=post name=form onsubmit="return ValidateForm()">
<TBODY>
<TR>
<TD id=titlelarge vAlign=left colSpan=4 height=25 width="618" background=images/title_sub.gif ><b>
<%=Thean%>
</b></TD></TR>
<TR>
<TD width=126 height=25><B>用户名称</B></TD>
<TD width=184 height=25>
<INPUT
maxLength=20 size=15 value='<%=Request.Cookies("username")%>' name=username></TD>
<TD width=91 height=25><B>您的密码</B></TD>
<TD width=184 height=25>
<INPUT
type=password size=15 value='<%=Request.Cookies("password")%>' name=userpass></TD></TR>
<TR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?