4、 加帖子(服务器端)bbs.asp:接收帖子内容,并存入bbs.mdb中。
bbs.asp<% name=REQUEST.FORM("name")
code=REQUEST.FORM("code")
subject=REQUEST.FORM("subject")
content=REQUEST.FORM("content")
curdate=Date
curtime=Time
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
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set InStream = FileObject.OpenTextFile ("c:\inetpub\wwwroot\hosp\asp\data.id", 1, False, False)
number = Cstr(InStream.Readline+1)
Set OutStream = FileObject.CreateTextFile ("c:\inetpub\wwwroot\hosp\asp\data.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
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 & " 添加贴子 " %>
返回论坛
姓名:<% =name %>
主题:<% =subject %>
内容:<% =content %>
<% Else %>
您的用户名或密码出错,请您重输!
<% End If
RS.Close
Connection.Close %>
中的
Set InStream = FileObject.OpenTextFile ("c:\inetpub\wwwroot\hosp\asp\data.id", 1, False, False)
number = Cstr(InStream.Readline+1)
Set OutStream = FileObject.CreateTextFile ("c:\inetpub\wwwroot\hosp\asp\data.id", True, False)
为什么扩展名是.id是什么文件啊???