以下是引用片段: <html> <head><title>bbs.asp</title></head> <body> <% name=REQUEST.FORM("name") code=REQUEST.FORM("code") subject=REQUEST.FORM("subject") content=REQUEST.FORM("content") curdate=Date curtime=Time <!-- 与author.mdb连接 --> Set Connection = Server.CreateObject("ADODB.Connection") Connection.Open "author" Set RS = Connection.Execute("SELECT * FROM author WHERE authname='" &name& "' AND password='" &code& "'") <!-- 判断用户名与密码是否匹配 --> If Not RS.EOF Then <!-- 打开数据文件,该文件存放帖子的编号,每加一个帖子,编号加1 --> Set FileObject = Server.CreateObject("Scripting.FileSystemObject") Set InStream = FileObject.OpenTextFile ("c:inetpubwwwroothospaspdata.id", 1, False, False) number = Cstr(InStream.Readline+1) Set OutStream = FileObject.CreateTextFile ("c:inetpubwwwroothospaspdata.id", True, False) OutStream.WriteLine number If Request.QueryString("ID")="" Then manswernum=number Else manswernum=Request.QueryString("ID") End If If Request.QueryString("topnum")="" Then mtopnum=number Else mtopnum=Request.QueryString("topnum") End If Set OutStream = Nothing <!-- 与bbs.mdb连接,将帖子信息存入数据库中 --> Set Connbbs = Server.CreateObject("ADODB.Connection") Connbbs.Open "bbs" Connbbs.Execute("INSERT INTO bbs(ID,authname,subject,content,adddate,addtime,answernum,topnum,visitnum) Values('" &number& "','" &name& "','" &subject& "','" &content& "','" &curdate& "','" &curtime& "','" &manswernum& "','" &mtopnum& "',0)") Connbbs.Close %> <% =curdate & " " %><% =curtime & " 添加贴子 " %> <a href="http://nt-server/hosp/asp/dispbbs.asp">返回论坛</a><P> 姓名:<% =name %><P> 主题:<% =subject %><P> 内容:<% =content %><P> <% Else %> 您的用户名或密码出错,请您重输! <% End If RS.Close Connection.Close %> </body> </html> |