%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim ErrorMsg
If Request.QueryString("Error") = "InvUID" Then
ErrorMsg = "Error: Username and/or password incorrect or doesn't exist. Please try again or register if you do not have a username and password."
ElseIf Request.QueryString("Error") = "Levels" Then
ErrorMsg = "Error: You do not have sufficient access rights to view the previously requested page"
End If
If Session("MM_UserAuthorization") = "#" Then
If Len(ErrorMsg) > 0 Then
ErrorMsg = ErrorMsg & " "
End If
ErrorMsg = ErrorMsg & "Please activate your account by using the activation email that was sent to the email address supplied during the registration process"
End If
If Request.QueryString("Msg") = 1 Then
If Len(ErrorMsg) > 0 Then
ErrorMsg = ErrorMsg & " "
End If
ErrorMsg = ErrorMsg & "Success: Your message was successfully sent"
End If
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="0,5,10,50"
MM_authorizedAdmin="0,5"
MM_authFailedURL="index.asp?Error=Levels"
MM_grantAccess=false
MM_IsAdmin=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedAdmin,Session("MM_UserAuthorization"))>=1) Then
MM_IsAdmin = true
End If
End If
%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
Session.Contents.Remove("MM_Username")
Session.Contents.Remove("MM_Fullname")
Session.Contents.Remove("MM_EmailAdd")
Session.Contents.Remove("MM_UserAuthorization")
Session.Contents.Remove("MM_UID")
MM_logoutRedirectPage = "index.asp"
' redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<%
Dim Categories
Dim Categories_cmd
Dim Categories_numRows
Set Categories_cmd = Server.CreateObject ("ADODB.Command")
Categories_cmd.ActiveConnection = MM_Forum_STRING
Categories_cmd.CommandText = "SELECT * FROM hcforum.categories ORDER BY CatID ASC"
Categories_cmd.Prepared = true
Set Categories = Categories_cmd.Execute
Categories_numRows = 0
%>
<%
Dim Topics
Dim Topics_cmd
Dim Topics_numRows
Set Topics_cmd = Server.CreateObject ("ADODB.Command")
Topics_cmd.ActiveConnection = MM_Forum_STRING
Topics_cmd.CommandText = "SELECT * FROM hcforum.topics ORDER BY TopicDate ASC"
Topics_cmd.Prepared = true
Set Topics = Topics_cmd.Execute
Topics_numRows = 0
%>
<%
Dim Comments
Dim Comments_cmd
Dim Comments_numRows
Set Comments_cmd = Server.CreateObject ("ADODB.Command")
Comments_cmd.ActiveConnection = MM_Forum_STRING
Comments_cmd.CommandText = "SELECT CommentID FROM hcforum.comments"
Comments_cmd.Prepared = true
Set Comments = Comments_cmd.Execute
Comments_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("txtUsername"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = "AccessID"
MM_redirectLoginSuccess = "index.asp"
MM_redirectLoginFailed = "index.asp?Error=InvUID"
MM_loginSQL = "SELECT UID, Username, Password, FirstName, Surname, EmailAddress, ActivationKey"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM hcforum.users WHERE Username = ? AND Password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_Forum_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 100, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 100, Request.Form("txtPassword")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
Session("MM_FullName") = MM_rsUser.Fields.Item("FirstName").Value + " " + MM_rsUser.Fields.Item("Surname").Value
Session("MM_EmailAdd") = MM_rsUser.Fields.Item("EmailAddress").Value
Session("MM_UID") = MM_rsUser.Fields.Item("UID").Value
If (MM_fldUserAuthorization <> "") AND (MM_rsUser.Fields.Item("ActivationKey").Value = "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = "#"
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<%= ErrorMsg %>
<% If Session("MM_Username") = "" Then %>
You are welcome to view this forum. If you wish to post a comment or start a new topic, you will be required to log in first.
If you do not yet have a username and password, please click here to register. <%Else%>
You are logged in as <%= Session("MM_FullName") %>. [Logout]
<%End If%>
<% If MM_IsAdmin Then%>[Admin Control Panel]
<%End If%>
The Glass Forum
<% 'For each category, do the following
Do While Not Categories.EOF
Topics.Close
Topics.Source = "SELECT * FROM topics WHERE CatID = " & Categories.Fields.Item("CatID").Value
Topics.Open
%>
<% If (MM_grantAccess) AND (NOT Categories.Fields.Item("CatID").Value = 1) Then %>[">Add a topic]<%End If%>
ID
Topic
Date
Views
Comments
Last Post
<% 'For each topic, do the following
If Topics.EOF Then
%>
There are currently no topics in this category.
<% End If
Do While Not Topics.EOF
Comments.Close
Comments.Source = "SELECT COUNT(CommentID) as CCount, MAX(CommentDate) As LastDate FROM comments WHERE TopicID = " & Topics.Fields.Item("TopicID").Value
Comments.Open
%>