%
dim id
rstable = tbl_content 'the content
const rsclstable = "class" 'class table
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
End Function
Function GetCode()
Dim TestObj
On Error Resume Next
Set TestObj = Server.CreateObject("Adodb.Stream")
Set TestObj = Nothing
If Err Then
Dim TempNum
Randomize timer
TempNum = Clng(8999*Rnd+1000)
Session("GetCode") = TempNum
GetCode = Session("GetCode")
Else
GetCode = ""
End If
End Function
%>
投稿指南
<% if ( request.Form("submit") = "") then %> <% else title = RemoveHTML(trim(request.Form("title"))) clsid = RemoveHTML(trim(request.Form("clsid"))) from = RemoveHTML(trim(request.Form("from"))) writer = RemoveHTML(trim(request.Form("writer"))) content = RemoveHTML(trim(request.Form("content"))) code=trim(request.Form("code")) If (code="") then response.Write alert("错误!\n你没有填写验证码!","back") response.End() End If if cstr(session("GetCode"))<>cstr(code) then response.Write alert("验证码错误!","index.asp") response.End() end if If (title="") then response.Write alert("错误!\n你没有填写文章标题!","back") response.End() End If If (writer="") then response.Write alert("错误!\n你没有填写作者!","back") response.End() End If If (content="") then response.Write alert("错误!\n你没有填写请输入内容!","back") response.End() End if set rs = server.CreateObject("adodb.recordset") rs.cursorlocation=3 rs.open "content",conn,1,2 rs.addnew rs("title") = title rs("clsid") = clsid rs("from") = from rs("writer") = writer rs("arcrank") = 0 rs("content") = content rs("time") = Format_Time(now(), 2) rs.update set rs =nothing response.Write " 投稿成功!请等待审核~"
end if
%>
|