%
'#################################################################################
'## Copyright (C) 2000 Michael Anderson and Pierre Gorissen
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
dim mLev, strLoginStatus
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
if (strAuthType = "nt") then
call NTauthenticate()
if (ChkAccountReg() = "1") then
call NTUser()
end if
end if
strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
strDBNTFUserName = Request.Form("Name")
if strAuthType = "nt" then
strDBNTUserName = Session(strCookieURL & "userID")
strDBNTFUserName = Session(strCookieURL & "userID")
end if
select case Request.Form("Method_Type")
case "login"
select case ChkUser2(strDBNTFUserName, Request.Form("Password"))
case 1, 2, 3, 4
Call DoCookies(Request.Form("SavePassword"))
strLoginStatus = 1
case else
strLoginStatus = 0
end select
case "logout"
Call ClearCookies()
end select
mLev = cint(ChkUser2(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword")))
Response.Write "" & vbcrlf & vbcrlf & _
"
" & vbcrlf & _
"" & strForumTitle & "" & vbcrlf & _
"" & vbcrlf
%>
<%
' WHOS ONLINE SCRIPT
Dim strOnlinePathInfo, strOnlineQueryString, strOnlineLocation
Dim strOnlineUser, strOnlineDate, strOnlineCheckInTime, strOnlineTimedOut
Dim strOnlineUsersCount, strOnlineGuestsCount, strOnlineMembersCount
Dim strOnlineGuestUserIP
' ******************************************************
' ADD HERE WHAT YOU WANT THE PREFIX OF YOUR COOKIE TO BE
' it will either be 'strCookieURL' or 'strUniqueID'
strTempCookieType = strUniqueID
' ******************************************************
Function OnlineSQLencode(byVal strPass)
If not isNull(strPass) and strPass <> "" Then
strPass = Replace(strPass, "%", "'%'")
strPass = Replace(strPass, "'", "''")
strPass = Replace(strPass, "|", "'|'")
OnlineSQLencode = strPass
End If
End Function
Function OnlineSQLdecode(byVal strPass)
If not isNull(strPass) and strPass <> "" Then
strPass = Replace(strPass, "'%'", "%")
strPass = Replace(strPass, "''", "'")
strPass = Replace(strPass, "'|'", "|")
OnlineSQLdecode = strPass
End If
End Function
' LETS GET WHAT PAGE THEY ARE ON
strOnlinePathInfo = Request.ServerVariables("Path_Info")
strOnlineQueryString = Request.QueryString
' TRY AND FIND OUT WHAT PAGE THEY ARE ON
If lcase(Right(strOnlinePathInfo, 9)) = "forum.asp" Then
strOnlineLocation = "" & Request.QueryString("Forum_Title") & ""
ElseIf lcase(Right(strOnlinePathInfo, 11)) = "default.asp" Then
strOnlineLocation = "Home"
ElseIf lcase(Right(strOnlinePathInfo, 9)) = "topic.asp" Then
strOnlineLocation = "Viewing Message ' " & Request.QueryString("Topic_Title") & " '"
ElseIf lcase(Right(strOnlinePathInfo, 8)) = "post.asp" Then
If Request.QueryString("method") = "Reply" Then
strOnlineLocation = "Replying To Message ' " & Request.QueryString("Topic_Title") & " '"
ElseIf Request.QueryString("method") = "Topic" Then
strOnlineLocation = "Posting New Topic in ' " & Request.QueryString("Forum_Title") & " '"
Else
strOnlineLocation = "Unknown"
End If
ElseIf lcase(Right(strOnlinePathInfo, 10)) = "active.asp" Then
strOnlineLocation = "Active Topics"
ElseIf lcase(Right(strOnlinePathInfo, 11)) = "members.asp" Then
strOnlineLocation = "Members"
ElseIf lcase(Right(strOnlinePathInfo, 10)) = "search.asp" Then
strOnlineLocation = "Search"
ElseIf lcase(Right(strOnlinePathInfo, 7)) = "faq.asp" Then
strOnlineLocation = "FAQ"
ElseIf lcase(Right(strOnlinePathInfo, 15)) = "pop_profile.asp" Then
If Request.QueryString("mode") = "Display" Then
strOnlineLocation = "Members Profile '"
Else
strOnlineLocation = "Profile"
End If
ElseIf lcase(Right(strOnlinePathInfo, 11)) = "pm_view.asp" Then
strOnlineLocation = "Private Message Inbox"
ElseIf lcase(Right(strOnlinePathInfo, 14)) = "pm_options.asp" Then
strOnlineLocation = "Private Messages Options"
ElseIf lcase(Right(strOnlinePathInfo, 15)) = "privatesend.asp" Then
strOnlineLocation = "Sending Private Message"
ElseIf lcase(Right(strOnlinePathInfo, 16)) = "active_users.asp" Then
strOnlineLocation = "Active Users"
Else
strOnlineLocation = "Unknown Page"
End If
' FIND OUT IF THEY ARE A GUEST, OR A USER
if Request.Cookies(strTempCookieType & "User")("Name") = "" then
strOnlineUser = "Guest"
else
strOnlineUser = Request.Cookies(strTempCookieType & "User")("Name")
end if
strOnlineUserIP = Request.ServerVariables("REMOTE_ADDR")
' LETS ENCODE THIS INFO
strOnlineUser = OnlineSQLencode(strOnlineUser)
strOnlineLocation = OnlineSQLencode(strOnlineLocation)
' SET WHEN TO TIMEOUT THE USER
' DO THIS IN SECONDS
strOnlineDate = DateToStr(Date)
strOnlineCheckInTime = DateToStr(Now())
strOnlineTimedOut = strOnlineCheckInTime - 180 'time out the user after 11 minutes ( 660 seconds )
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = strConnString
objConn.Open
strSql = "SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.LastChecked"
strSql = strSql & " FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strTablePrefix & "ONLINE.UserIP='" & strOnlineUserIP & "' AND " & strTablePrefix & "ONLINE.UserID='" & strOnlineUser & "'"
set rsWho = my_Conn.Execute (strSql)
if rsWho.eof or rsWho.bof then
' THEY ARE A NEW USER SO INSERT THERE USERNAME
on error resume next
Set objRS2 = Server.CreateObject("ADODB.Recordset")
strSQL = "INSERT INTO " & strTablePrefix & "ONLINE (UserID,UserIP,DateCreated,CheckedIn,LastChecked,M_BROWSE) VALUES ('"
strSql = strSQL & strOnlineUser & "','" & strOnlineUserIP & "','" & strOnlineDate & "','" & strOnlineCheckInTime & "','" & strOnlineCheckInTime & "','" & strOnlineLocation & "')"
my_Conn.Execute (strSql)
if err.number <> 0 then response.write err.number & "|" & err.description
else
' THEY ARE A ACTIVE USER
strSql = "SELECT " & strTablePrefix & "ONLINE.UserID, " & strTablePrefix & "ONLINE.UserIP, " & strTablePrefix & "ONLINE.LastChecked"
strSql = strSql & " FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE " & strTablePrefix & "ONLINE.UserID='" & strOnlineUser & "' AND " & strTablePrefix & "ONLINE.UserIP = '" & strOnlineUserIP & "'"
set rsLastChecked = my_Conn.Execute (strSql)
' LETS UPDATE THE TABLE SO IT SHOWS THERE LAST ACTIVE VISIT
strSql = "UPDATE " & strTablePrefix & "ONLINE SET M_BROWSE='" & strOnlineLocation & "' , LastChecked='" & strOnlineCheckInTime & "' WHERE UserID='" & strOnlineUser & "' AND " & strTablePrefix & "ONLINE.UserIP='" & strOnlineUserIP & "'"
my_Conn.Execute (strSql)
end if
' LETS DELETE ALL INACTIVE USERS
SQL = "DELETE FROM " & strTablePrefix & "ONLINE WHERE LastChecked < '" & strOnlineTimedOut & "'"
objConn.Execute SQL
set rsOnline = Server.CreateObject("ADODB.Recordset")
if strDBType = "access" then
strSqL = "SELECT count(UserID) AS [onlinecount] "
else
strSqL = "SELECT count(UserID) onlinecount "
end if
strSql = strSql & "FROM " & strTablePrefix & "ONLINE "
Set rsOnline = my_Conn.Execute(strSql)
onlinecount = rsOnline("onlinecount")
strOnlineUsersCount = rsOnline("onlinecount")
' Get Guest count for display on Default.asp
set rsGuests = Server.CreateObject("ADODB.Recordset")
if strDBType = "access" then
strSqL = "SELECT count(UserID) AS [Guests] "
else
strSqL = "SELECT count(UserID) Guests "
end if
strSql = strSql & "FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE Right(UserID, 5) = 'Guest' "
Set rsGuests = my_Conn.Execute(strSql)
Guests = rsGuests("Guests")
strOnlineGuestsCount = rsGuests("Guests")
' Get Member count for display on Default.asp
set rsGuests = Server.CreateObject("ADODB.Recordset")
if strDBType = "access" then
strSqL = "SELECT count(UserID) AS [Members] "
else
strSqL = "SELECT count(UserID) Members "
end if
strSql = strSql & "FROM " & strTablePrefix & "ONLINE "
strSql = strSql & " WHERE Right(UserID, 5) <> 'Guest' "
Set rsMembers = my_Conn.Execute(strSql)
Members = rsMembers("Members")
strOnlineMembersCount = rsMembers("Members")
' END WHOS ONLINE SCRIPT
%>
<%
if strLoginStatus = 0 then%>
Your username and/or password were incorrect.
Please either try again or register for an account.
<%
else %>
You logged on successfully!
Thank you for your participation.
<%
end if %>
">
">Back To Forum
<% Response.End
case "logout" %>
You logged out successfully!
Thank you for your participation.
">
">Back To Forum
<%
Response.End
end select
if (ChkUser2((strDBNTUserName), (Request.Cookies(strUniqueID & "User")("Pword"))) = 0) then %>
<%
else %>
<%
end if %>