%
'Option Explicit
Dim sql,rsEntry,forumid,subject,message,icon,notfilled(1),badflag,count,newid,username
username = Request.Cookies("junooni_userid")
'Assign form values to variables
subject = Request.Form("subject")
icon = Request.Form("icon")
message = Request.Form("message")
forumid = Request.Form("forumid")
'Check everything's been filled in, badflag determines whether error function is called
badflag = 0
if subject = "" then
notfilled(0) = "Subject"
badflag = 1
end if
if message = "" then
notfilled(1) = "Message"
badflag = 1
end if
if badflag = 1 then
posterror()
end if
'Open connection and insert topic into the database
%>
<%
Call Connjunooni(Conn)
if not loginstatus(username)Then
response.redirect "login.asp"
end if
message = RemoveHTMLTags(message)
Set rsEntry = Server.CreateObject("ADODB.Recordset")
rsEntry.open "topics", conn, 3, 3
rsEntry.AddNew
rsEntry("topic_by") = username
rsEntry("lastpost") = username
rsEntry("subject") = RemoveHTMLTags(subject)
rsEntry("icon") = icon
rsEntry("message") = FormatText(message)
rsEntry("forum") = forumid
rsEntry("date") = date()
rsEntry("time") = time()
rsEntry("lastdate") = date()
rsEntry("lasttime") = time()
rsEntry("locked") = 0
rsEntry("topic_read") = 0
rsEntry("replies") = 0
rsEntry("topicstatus") = "Y"
rsEntry.Update
rsEntry.MoveLast
newid = rsEntry("id")
rsEntry.close
rsEntry.open "forums WHERE forumid = " & forumid, conn, 3, 3
rsEntry("topics") = rsEntry("topics") + 1
rsEntry("posts") = rsEntry("posts") + 1
rsEntry.Update
rsEntry.close
set rsEntry = nothing
conn.close
set conn = nothing
Response.Redirect("read.asp?id=" & newid)
%>
<%Function posterror()%>
Junoon.com : Forumboard
| Please enter your username and password to login |
|
You have not filled in the following fields correctly:
<%for count = 0 to 1%>
<%if notfilled(count) <> "" then%>
<%=notfilled(count)%>
<%end if%>
<%next%>
Please try again
<%Response.end
End Function%>
|
|
|