<!-- #INCLUDE FILE="includes/admin_common.asp" -->
<% ValidateAdmin %>
<html>
<head>
<title>Add New Forum</title>
</head>
<body>
<%
'Find out what to do
Dim strAction 
strAction = Request.Querystring("action")
if strAction = "" then
strAction = "start"
end if
'Variables for new forum record
Dim iForumName, iForumDescription, iForumStart, iForumGroup, strSQL
iForumName = Trim(cStr(Request.Form("forum_name")))
iForumDescription = Trim(cStr(Request.Form("forum_description")))
iForumStart = Date()
iForumGroup = Trim(cStr(Request.Form("forum_grouping")))
if iForumGroup = "" then
iForumGroup = "none"
end if

%>

<%
ShowAdminTable

select case strAction
 
case "start"
'display form for adding a forum
%>
<table><tr><td>
Please fill out the following fields to add a forum
</td></tr>
<tr><td><form action="add_forum.asp?action=done" method="post">
<table>
<tr><td>Name of Forum:</td><td><input type="text" name="forum_name" size="20"></input></td></tr>
<tr><td>Description:</td><td><input type="text" name="forum_description" size="20"></input></td></tr>
<tr><td>Grouping:</td><td><input type="text" name="forum_grouping" size="10"></input>  For grouping by month and day, type: "7days"</td></tr>
<tr><td></td><td><input type="submit" value="Add Forum"></form></td></tr></table>
</td></tr></table>

<%
case "done"
'create data connection
%>

<OBJECT RUNAT="server" PROGID="ADODB.Connection" id="cnnAdmin"> </OBJECT>
<%
'open connection
cnnAdmin.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SERVER.MapPath("../database/forum.mdb") & ";"
'Build StrSQL
strSQL = ""
		strSQL = strSQL & "INSERT INTO forums "
		strSQL = strSQL & "(forum_name, forum_description, forum_start_date, forum_grouping) " & vbCrLf
		strSQL = strSQL & "VALUES ("
		strSQL = strSQL & "'" & iForumName & "'"
		strSQL = strSQL & ", "
		strSQL = strSQL & "'" & iForumDescription & "'"
		strSQL = strSQL & ", "
		strSQL = strSQL & "'" & iForumStart & "'"
		strSQL = strSQL & ", "
		strSQL = strSQL & "'" & iForumGroup & "'"
		strSQL = strSQL & ");"
%><%= strSQL %><%
'Add Record without returning any records.
cnnAdmin.Execute strSQL, adCmdText Or adExecuteNoRecords
cnnAdmin.Close

'Tell them that the forum has been created
%>
<br><br><br>
<font size=+1>The Forum <%= iForumName %> has been created </font>

<%
End Select

%>
</body>
</html>









