<% '============================= 'adding a new top level post '(a subject really) '============================= dim error, error_msg, all_done if Request.QueryString("insert") = "yes" then 'ok, they want to add something to the forum - a good thing :] if trim(Request.Form("title")) = "" then error = true error_msg = error_msg & "
  • The post can NOT be blank, try again with something in the field this time :]
  • " end if call msg_insert_check(trim(Request.Form("title"))) if not error then call insert_category(trim(Request.Form("title"))) end if end if function msg_insert_check(byval title) set con = Server.CreateObject("ADODB.Connection") con.Open(DSN) 'open the connection to the DSN (SQL server) query = "SELECT id from forum_msg " & _ "where is_category = 1 and msg_title = '" & SQLSafe(title) & "'" 'for a quick debug of the query 'Response.Write("query = [" & query & "]
    ") set RS=con.Execute(query) if not RS.eof then error = true error_msg = error_msg & "
  • The topic you are trying to post already exist on the ..::LvL Fourms database, did you hit the submit button twice?
  • " end if con.close end function '======================================= 'the insert_category function adds a top level post function insert_category(byval title) set con = Server.CreateObject("ADODB.Connection") con.Open(DSN) query = "INSERT INTO forum_msg " & _ " (is_category, msg_title, who_posted) " & _ "VALUES " & _ " (1, '" & SQLSafe(title) & "', '..::LvL admin')" con.Execute(query) con.Close all_done = true end function %> [ admin ]

    ..::LvL Forum admin - adding a subject
    +---------------------

    <% if all_done then %>

    Your top level topic/category called <%=Request.Form("title")%> has been add to the ..::LvL forums

    <% else %>
    ?insert=yes" method="post">

    title of post (What everyone will see :])
    " maxlength="64" />

    <% end if %>