<% If request("button")<>"" then If request("name")="" then mesg = " Error, Categoray Name cannot be Empty!" else addcategory End if End if %> <%=sitename%> <%=meta%>

<%searchbox%> <%loginform%>

<%=sitename%> Categories

<% set dbConn = Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") dbConn.Open ConStr sql = "SELECT * FROM category ORDER BY lastpost desc;" rs.Open sql, dbConn, 1,2 While not rs.EOF %> <% rs.MoveNext Wend %>
Id Name Descriiption Date Posts Last Post
<%=rs("id")%> <%logincheck rs("id")%><%=rs("name")%>  <%=rs("description")%> <%=rs("date")%> <%=rs("posts")%> <%=rs("lastpost")%> 
<% If rs.recordcount=0 Then response.write "
There are no categories available at the moment.
Please add atleast 1 category for users to post messages.
" rs.Close dbconn.Close set dbConn = Nothing set rs1 = Nothing %>
<%If session("userisadmin") Then%>

Add a new Category: <%=mesg%>
Name:

Description:

<% End If%>

<% Sub logincheck(id) if session("userisadmin") then response.write "x#" End Sub Function addcategory() 'On error resume next ''''''''''''''''''''''''''''' Set dbConn = Server.CreateObject("ADODB.Connection") Set rs2 = Server.CreateObject("ADODB.Recordset") mySQL = "Select * from category;" dbConn.Open session("constr") rs2.Open mySQL, dbConn ,1,3 rs2.addnew rs2("name") = request("name") rs2("description") = request("desc") rs2.update rs2.close Set rs2 = Nothing Set dbConn = Nothing End Function %>