%
'#################################################################################
'## 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
'#################################################################################
function ChkUrls(fString, fTestTag, fType)
Dim strArray
Dim Counter
Dim strTempString
strTempString = fString
if Instr(1, fString, fTestTag) > 0 then
strArray = Split(fString, fTestTag, -1)
strTempString = strArray(0)
for counter = 1 to UBound(strArray)
if ((strArray(counter-1) = "" or len(strArray(counter-1)) < 5) and strArray(counter)<> "") then
strTempString = strTempString & edit_hrefs("" & fTestTag & strArray(counter), fType)
elseif ((UCase(right(strArray(counter-1),6)) <> "HREF=""") and (UCase(right(strArray(counter-1),5)) <> "[URL]") and (UCase(right(strArray(counter-1),6)) <> "[URL=""") and (UCase(right(strArray(counter-1),7)) <> "FILE:///") and (UCase(right(strArray(counter-1),7)) <> "HTTP://") and (UCase(right(strArray(counter-1),8)) <> "HTTPS://") and (UCase(right(strArray(counter-1),5)) <> "SRC=""") and (UCase(right(strArray(counter-1),5)) <> "SRC=""") and strArray(counter)<> "") then
strTempString = strTempString & edit_hrefs("" & fTestTag & strArray(counter), fType)
else
strTempString = strTempString & fTestTag & strArray(counter)
end if
next
end if
ChkUrls = strTempString
end function
function ChkMail(fString, fTestTag, fType)
Dim strArray
Dim Counter
Dim strTempString
strTempString = fString
if Instr(1, fString, fTestTag) > 0 then
strArray = Split(fString, fTestTag, -1)
strTempString = ""
' strTempString = strArray(0)
for counter = 0 to UBound(strArray)
if (Instr(strArray(counter), "@") > 0) and not(Instr(strArray(counter), "mailto:") > 0) and not(Instr(UCase(strArray(counter)), "[URL") > 0) then
strTempString = strTempString & edit_hrefs("" & fTestTag & strArray(counter), fType)
else
strTempString = strTempString & fTestTag & strArray(counter)
end if
next
end if
ChkMail = strTempString
end function
function FormatStr(fString)
on Error resume next
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "
")
fString = replace(fString, "[br]", " ", 1, -1, 1)
if strIMGInPosts = "1" then
fString = doCode(fString, "[img]","[/img]","")
fString = doCode(fString, "[image]","[/image]","")
fString = doCode(fString, "[img=right]","[/img=right]","")
fString = doCode(fString, "[image=right]","[/image=right]","")
fString = doCode(fString, "[img=left]","[/img=left]","")
fString = doCode(fString, "[image=left]","[/image=left]","")
end if
end if
end if
if strIcons = "1" and _
fField_Type <> "title" and _
fField_Type <> "hidden" then
fString= smile(fString)
end if
if fField_Type = "preview" then
if strAllowHTML <> "1" then
fString = HTMLEncode(fString)
end if
end if
if fField_Type <> "hidden" and _
fField_Type <> "preview" then
fString = Replace(fString, "'", "''")
end if
ChkString = fString
end function
function ChkDateTime(fDateTime)
if fDateTime = "" then
exit function
end if
if IsDate(fDateTime) then
select case strDateType
case "dmy"
ChkDateTime = Mid(fDateTime,7,2) & "/" & _
Mid(fDateTime,5,2) & "/" & _
Mid(fDateTime,1,4)
case "mdy"
ChkDateTime = Mid(fDateTime,5,2) & "/" & _
Mid(fDateTime,7,2) & "/" & _
Mid(fDateTime,1,4)
case "ymd"
ChkDateTime = Mid(fDateTime,1,4) & "/" & _
Mid(fDateTime,5,2) & "/" & _
Mid(fDateTime,7,2)
case "ydm"
ChkDateTime =Mid(fDateTime,1,4) & "/" & _
Mid(fDateTime,7,2) & "/" & _
Mid(fDateTime,5,2)
case "dmmy"
ChkDateTime = Mid(fDateTime,7,2) & " " & _
Monthname(Mid(fDateTime,5,2),1) & " " & _
Mid(fDateTime,1,4)
case "mmdy"
ChkDateTime = Monthname(Mid(fDateTime,5,2),1) & " " & _
Mid(fDateTime,7,2) & " " & _
Mid(fDateTime,1,4)
case "ymmd"
ChkDateTime = Mid(fDateTime,1,4) & " " & _
Monthname(Mid(fDateTime,5,2),1) & " " & _
Mid(fDateTime,7,2)
case "ydmm"
ChkDateTime = Mid(fDateTime,1,4) & " " & _
Mid(fDateTime,7,2) & " " & _
Monthname(Mid(fDateTime,5,2),1)
case "dmmmy"
ChkDateTime = Mid(fDateTime,7,2) & " " & _
Monthname(Mid(fDateTime,5,2),0) & " " & _
Mid(fDateTime,1,4)
case "mmmdy"
ChkDateTime = Monthname(Mid(fDateTime,5,2),0) & " " & _
Mid(fDateTime,7,2) & " " & _
Mid(fDateTime,1,4)
case "ymmmd"
ChkDateTime = Mid(fDateTime,1,4) & " " & _
Monthname(Mid(fDateTime,5,2),0) & " " & _
Mid(fDateTime,7,2)
case "ydmmm"
ChkDateTime = Mid(fDateTime,1,4) & " " & _
Mid(fDateTime,7,2) & " " & _
Monthname(Mid(fDateTime,5,2),0)
case else
ChkDateTime = doublenum(Mid(fDateTime,5,2)) & "/" & _
Mid(fDateTime,7,2) & "/" & _
Mid(fDateTime,1,4)
end select
if strTimeType = 12 then
if cint(Mid(fDateTime, 9,2)) > 12 then
ChkDateTime = ChkDateTime & " " & _
(cint(Mid(fDateTime, 9,2)) -12) & ":" & _
Mid(fDateTime, 11,2) & ":" & _
Mid(fDateTime, 13,2) & " " & "PM"
elseif cint(Mid(fDateTime, 9,2)) = 12 then
ChkDateTime = ChkDateTime & " " & _
cint(Mid(fDateTime, 9,2)) & ":" & _
Mid(fDateTime, 11,2) & ":" & _
Mid(fDateTime, 13,2) & " " & "PM"
elseif cint(Mid(fDateTime, 9,2)) = 0 then
ChkDateTime = ChkDateTime & " " & _
(cint(Mid(fDateTime, 9,2)) +12) & ":" & _
Mid(fDateTime, 11,2) & ":" & _
Mid(fDateTime, 13,2) & " " & "AM"
else
ChkDateTime = ChkDateTime & " " & _
Mid(fDateTime, 9,2) & ":" & _
Mid(fDateTime, 11,2) & ":" & _
Mid(fDateTime, 13,2) & " " & "AM"
end if
else
ChkDateTime = ChkDateTime & " " & _
Mid(fDateTime, 9,2) & ":" & _
Mid(fDateTime, 11,2) & ":" & _
Mid(fDateTime, 13,2)
end if
end if
end function
function ChkDateFormat(strDateTime)
ChkDateFormat = isdate("" & Mid(strDateTime, 5,2) & "/" & Mid(strDateTime, 7,2) & "/" & Mid(strDateTime, 1,4) & " " & Mid(strDateTime, 9,2) & ":" & Mid(strDateTime, 11,2) & ":" & Mid(strDateTime, 13,2) & "")
end function
function StrToDate(strDateTime)
if ChkDateFormat(strDateTime) then
StrToDate = cdate("" & Mid(strDateTime, 5,2) & "/" & Mid(strDateTime, 7,2) & "/" & Mid(strDateTime, 1,4) & " " & Mid(strDateTime, 9,2) & ":" & Mid(strDateTime, 11,2) & ":" & Mid(strDateTime, 13,2) & "")
else
StrToDate = "" & strForumTimeAdjust
end if
end function
function DateToStr(dtDateTime)
DateToStr = year(dtDateTime) & doublenum(Month(dtdateTime)) & doublenum(Day(dtdateTime)) & doublenum(Hour(dtdateTime)) & doublenum(Minute(dtdateTime)) & doublenum(Second(dtdateTime)) & ""
end function
function ReadLastHereDate(UserName)
dim TempLastHereDate
dim rs_date
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_LASTHEREDATE "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS."&Strdbntsqlname&" = '" & UserName & "' "
set rs_date = my_conn.Execute (strSql)
if (rs_date.BOF and rs_date.EOF) then
TempLastHereDate = DateAdd("d",-10,strForumTimeAdjust)
else
TempLastHereDate = StrToDate(rs_date("M_LASTHEREDATE"))
if TempLastHereDate = "" or IsNull(TempLastHereDate) then
TempLastHereDate = DateAdd("d",-10,strForumTimeAdjust)
end if
end if
rs_date.close
set rs_date = nothing
'## Forum_SQL - Do DB Update
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTHEREDATE = '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & UserName & "' "
my_conn.Execute (strSql)
ReadLastHereDate = DateToStr(TempLastHereDate)
end function
function getMemberID(fUser_Name)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE M_NAME = '" & fUser_Name & "'"
rsGetMemberID = my_Conn.Execute(strSql)
getMemberID = rsGetMemberID("MEMBER_ID")
end function
function ChkDate(fDate)
if fDate = "" then
exit function
end if
'if IsDate(fDate) then
select case strDateType
case "dmy"
ChkDate = Mid(fDate,7,2) & "/" & _
Mid(fDate,5,2) & "/" & _
Mid(fDate,1,4)
case "mdy"
ChkDate = Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,1,4)
case "ymd"
ChkDate = Mid(fDate,1,4) & "/" & _
Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2)
case "ydm"
ChkDate =Mid(fDate,1,4) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,5,2)
case "dmmy"
ChkDate = Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,1,4)
case "mmdy"
ChkDate = Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,7,2) & " " & _
Mid(fDate,1,4)
case "ymmd"
ChkDate = Mid(fDate,1,4) & " " & _
Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,7,2)
case "ydmm"
ChkDate = Mid(fDate,1,4) & " " & _
Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),1)
case "dmmmy"
ChkDate = Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,1,4)
case "mmmdy"
ChkDate = Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,7,2) & " " & _
Mid(fDate,1,4)
case "ymmmd"
ChkDate = Mid(fDate,1,4) & " " & _
Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,7,2)
case "ydmmm"
ChkDate = Mid(fDate,1,4) & " " & _
Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),0)
case else
ChkDate = Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,1,4)
End Select
'end if
end function
function ChkTime(fTime)
if fTime = "" then
exit function
end if
if strTimeType = 12 then
if cint(Mid(fTime, 9,2)) > 12 then
ChkTime = ChkTime & " " & _
(cint(Mid(fTime, 9,2)) -12) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "PM"
elseif cint(Mid(fTime, 9,2)) = 12 then
ChkTime = ChkTime & " " & _
cint(Mid(fTime, 9,2)) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "PM"
elseif cint(Mid(fTime, 9,2)) = 0 then
ChkTime = ChkTime & " " & _
(cint(Mid(fTime, 9,2)) +12) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "AM"
else
ChkTime = ChkTime & " " & _
Mid(fTime, 9,2) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2) & " " & "AM"
end if
else
ChkTime = ChkTime & " " & _
Mid(fTime, 9,2) & ":" & _
Mid(fTime, 11,2) & ":" & _
Mid(fTime, 13,2)
end if
end function
function EmailField(fTestString)
TheAt = Instr(2, fTestString, "@")
if TheAt = 0 then
EmailField = 0
else
TheDot = Instr(cint(TheAt) + 2, fTestString, ".")
if TheDot = 0 then
EmailField = 0
else
if cint(TheDot) + 1 > Len(fTestString) then
EmailField = 0
else
EmailField = -1
end if
end if
end if
end function
function ChkIsNew(fDateTime)
if strHotTopic = "1" then
if fDateTime > Session(strCookieURL & "last_here_date") then
if rs("T_REPLIES") >= intHotTopicNum then
ChkIsNew = ""
else
ChkIsNew = ""
end if
else
if rs("T_REPLIES") >= intHotTopicNum then
ChkIsNew = ""
else
ChkIsNew = ""
end if
end if
else
if fDateTime > Session(strCookieURL & "last_here_date") then
ChkIsNew = ""
else
ChkIsNew = ""
end if
end if
end function
function ChkQuoteOk(fString)
ChkQuoteOk = not(InStr(1, fString, "'", 0) > 0)
end function
function ChkUser(fName, fPassword)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_PASSWORD "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & fName & "' "
if strAuthType="db" then
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_PASSWORD = '" & fPassword &"'"
End IF
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
set rsCheck = my_Conn.Execute (strSql)
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
ChkUser = 0
else
if cstr(rsCheck("MEMBER_ID")) = Request.Form("Author") then
ChkUser = 1 '## Author
else
Select case cint(rsCheck("M_LEVEL"))
case 1
ChkUser = 2 '## Normal User
case 2
ChkUser = 3 '## Moderator
case 3
ChkUser = 4 '## Admin
case else
ChkUser = cint(rsCheck("M_LEVEL"))
End Select
end if
end if
rsCheck.close
set rsCheck = nothing
end function
function ChkUser2(fName, fPassword)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_PASSWORD "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
StrSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & fName & "' "
if strAuthType="db" then
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_PASSWORD = '" & fPassword &"'"
End If
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
on error resume next
set rsCheck = my_Conn.Execute (strSql)
for counter = 0 to my_Conn.Errors.Count -1
if my_Conn.Errors(counter).Number <> 0 or Err.number > 0 then
ChkUser2 = -1
my_Conn.Errors.Clear
end if
next
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) or ChkUser2 = -1 then
ChkUser2 = 0 '## Invalid Password
else
if cint(rsCheck("MEMBER_ID")) = cint(Request.QueryString("Author")) then
ChkUser2 = 1 '## Author
else
select case cint(rsCheck("M_LEVEL"))
case 1
ChkUser2 = 2 '## Normal User
case 2
ChkUser2 = 3 '## Moderator
case 3
ChkUser2 = 4 '## Admin
case else
ChkUser2 = cint(rsCheck("M_LEVEL"))
end select
end if
end if
rsCheck.close
set rsCheck = nothing
end function
function ChkUser3(fName, fPassword, fReply)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strMemberTablePrefix & "MEMBERS.M_PASSWORD, " & strTablePrefix & "REPLY.R_AUTHOR "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strTablePrefix & "REPLY "
StrSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & fName & "' "
if strAuthType="db" then
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_PASSWORD = '" & fPassword &"' "
End If
strSql = strSql & " AND " & strTablePrefix & "REPLY.REPLY_ID = " & fReply
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
set rsCheck = my_Conn.Execute (strSql)
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
ChkUser3 = 0 '## Invalid Password
else
if cint(rsCheck("MEMBER_ID")) = cint(rsCheck("R_AUTHOR")) then
ChkUser3 = 1 '## Author
else
Select case cint(rsCheck("M_LEVEL"))
case 1
ChkUser3 = 2 '## Normal User
case 2
ChkUser3 = 3 '## Moderator
case 3
ChkUser3 = 4 '## Admin
case else
ChkUser3 = cint(rsCheck("M_LEVEL"))
End Select
end if
end if
rsCheck.close
set rsCheck = nothing
end function
function GetSig(fUser_Name)
'## Forum_SQL
strSql = "SELECT M_SIG "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE M_NAME = '" & Request.Form("UserName") & "'"
set rsSig = my_Conn.Execute (strSql)
if rsSig.EOF or rsSig.BOF then
'## Do Nothing
else
GetSig = rsSig("M_SIG")
end if
rsSig.close
set rsSig = nothing
end function
function DoDropDown(fTableName, fDisplayField, fValueField, fSelectValue, fName)
'## Forum_SQL
strSql = "SELECT " & fDisplayField & ", " & fValueField
strSql = strSql & " FROM " & fTableName
rsdrop.Open strSql, my_Conn
Response.Write "" & vbCrLf
rsdrop.Close
set rsdrop = nothing
end function
sub DoULastPost(sUser_Name)
'## Forum_SQL - Updates the M_LASTPOSTDATE in the FORUM_MEMBERS table
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET M_LASTPOSTDATE = '" & DateToStr(strForumTimeAdjust) & "' "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & sUser_Name & "'"
my_Conn.Execute (strSql)
end sub
'##############################################
'## Ranks and Stars ##
'##############################################
function getMember_Level(fM_TITLE, fM_LEVEL, fM_POSTS)
dim Member_Level
Member_Level = ""
if Trim(fM_TITLE) <> "" then
Member_Level = fM_TITLE
else
select case fM_LEVEL
case "1"
if (fM_POSTS < intRankLevel1) then Member_Level = Member_Level & strRankLevel0
if (fM_POSTS >= intRankLevel1) and (fM_POSTS < intRankLevel2) then Member_Level = Member_Level & strRankLevel1
if (fM_POSTS >= intRankLevel2) and (fM_POSTS < intRankLevel3) then Member_Level = Member_Level & strRankLevel2
if (fM_POSTS >= intRankLevel3) and (fM_POSTS < intRankLevel4) then Member_Level = Member_Level & strRankLevel3
if (fM_POSTS >= intRankLevel4) and (fM_POSTS < intRankLevel5) then Member_Level = Member_Level & strRankLevel4
if (fM_POSTS >= intRankLevel5) then Member_Level = Member_Level & strRankLevel5
case "2"
Member_Level = Member_Level & strRankMod
case "3"
Member_Level = Member_Level & strRankAdmin
case else
Member_Level = Member_Level & "Error"
end select
end if
getMember_Level = Member_Level
end function
function getStar_Level(fM_LEVEL, fM_POSTS)
dim Star_Level
Star_Level = ""
select case fM_LEVEL
case "1"
if (fM_POSTS < intRankLevel1) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel1) and (fM_POSTS < intRankLevel2) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel2) and (fM_POSTS < intRankLevel3) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel3) and (fM_POSTS < intRankLevel4) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel4) and (fM_POSTS < intRankLevel5) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel5) then Star_Level = Star_Level & ""
case "2"
if fM_POSTS < intRankLevel1 then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel1) and (fM_POSTS < intRankLevel2) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel2) and (fM_POSTS < intRankLevel3) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel3) and (fM_POSTS < intRankLevel4) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel4) and (fM_POSTS < intRankLevel5) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel5) then Star_Level = Star_Level & ""
case "3"
if (fM_POSTS < intRankLevel1) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel1) and (fM_POSTS < intRankLevel2) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel2) and (fM_POSTS < intRankLevel3) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel3) and (fM_POSTS < intRankLevel4) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel4) and (fM_POSTS < intRankLevel5) then Star_Level = Star_Level & ""
if (fM_POSTS >= intRankLevel5) then Star_Level = Star_Level & ""
case else
Star_Level = Star_Level & "Error"
end select
getStar_Level = Star_Level
end function
'##############################################
'## Multi-Moderators ##
'##############################################
function chkForumModerator(fForum_ID, fMember_Name)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & fMember_Name & "'"
set rsUsrName = my_Conn.Execute (strSql)
if rsUsrName.EOF or rsUsrName.BOF or not(ChkQuoteOk(fMember_Name)) or not(ChkQuoteOk(fForum_ID)) then
chkForumModerator = "0"
rsUsrName.close
exit function
else
MEMBER_ID = rsUsrName("MEMBER_ID")
rsUsrName.close
end if
set rsUsrName = nothing
'## Forum_SQL
strSql = "SELECT * "
strSql = strSql & " FROM " & strTablePrefix & "MODERATOR "
strSql = strSql & " WHERE FORUM_ID = " & fForum_ID & " "
strSql = strSql & " AND MEMBER_ID = " & MEMBER_ID
set rsChk = my_Conn.Execute (strSql)
if rsChk.bof or rsChk.eof then
chkForumModerator = "0"
else
chkForumModerator = "1"
end if
rsChk.close
set rsChk = nothing
end function
function listForumModerators(fForum_ID)
'## Forum_SQL
strSql = "SELECT * "
strSql = strSql & " FROM " & strTablePrefix & "MODERATOR "
strSql = strSql & " WHERE FORUM_ID = " & fForum_ID
set rsChk = my_Conn.Execute (strSql)
if rsChk.EOF or not(ChkQuoteOk(fForum_ID)) then
listForumModerators = ""
exit function
end if
fMods = getMemberName(rsChk("MEMBER_ID"))
rsChk.MoveNext
do until rsChk.EOF
fMods = fMods & ", " & getMemberName(rsChk("MEMBER_ID"))
rsChk.MoveNext
loop
rsChk.close
set rsChk = nothing
listForumModerators = fMods
end function
function getMemberName(fUser_Number)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_NAME"
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE MEMBER_ID = " & fUser_Number
set rsGetMemberID = my_Conn.Execute(strSql)
if rsGetMemberID.EOF or rsGetMemberID.BOF then
getMemberName = ""
else
getMemberName = rsGetMemberID("M_NAME")
end if
end function
function getMemberNumber(fUser_Name)
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE M_NAME = '" & fUser_Name & "'"
set rsGetMemberID = my_Conn.Execute(strSql)
if rsGetMemberID.EOF or rsGetMemberID.BOF then
getMemberNumber = -1
exit function
end if
getMemberNumber = rsGetMemberID("MEMBER_ID")
end function
'##############################################
'## NT Authentication ##
'##############################################
sub NTUser()
if Session(strCookieURL & "username")="" then
'## Forum_SQL
strSql ="SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_PASSWORD, " & strMemberTablePrefix & "MEMBERS.M_USERNAME, " & strMemberTablePrefix & "MEMBERS.M_NAME "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_USERNAME = '" & Session(strCookieURL & "userid") & "'"
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
set rs_chk = my_conn.Execute (strSql)
if rs_chk.BOF or rs_chk.EOF then
strLoginStatus = 0
else
Session(strCookieURL & "username") = rs_chk("M_NAME")
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("Name") = rs_chk("M_NAME")
Response.Cookies(strUniqueID & "User")("Pword") = rs_chk("M_PASSWORD")
Response.Cookies(strUniqueID & "User")("Cookies") = ""
Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Request.Form("Name"))
if strAuthType = "nt" then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Session(strCookieURL & "userID"))
end if
strLoginStatus = 1
mLev = cint(ChkUser2(Request.Cookies(strUniqueID & "User")("Name"), Request.Cookies(strUniqueID & "User")("Pword")))
if mLev = 4 then
Session(strCookieURL & "Approval") = "15916941253"
end if
end if
rs_chk.close
set rs_chk = nothing
end if
end sub
function ChkAccountReg()
'## Forum_SQL
strSql ="SELECT " & strMemberTablePrefix & "MEMBERS.M_LEVEL, " & strMemberTablePrefix & "MEMBERS.M_USERNAME "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_USERNAME = '" & Session(strCookieURL & "userid") & "'"
strSql = strSql & " AND " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
set rs_chk = my_conn.Execute (strSql)
if rs_chk.BOF or rs_chk.EOF then
ChkAccountReg = "0"
else
ChkAccountReg = "1"
end if
rs_chk.close
set rs_chk = nothing
end function
sub NTAuthenticate()
dim strUser, strNTUser, checkNT
strNTUser = Request.ServerVariables("AUTH_USER")
strNTUser = replace(strNTUser, "\", "/")
if Session(strCookieURL & "userid") = "" then
strUser = Mid(strNTUser,(instr(1,strNTUser,"/")+1),len(strNTUser))
Session(strCookieURL & "userid") = strUser
end if
if strNTGroups="1" then
strNTGroupsSTR = Session(strCookieURL & "strNTGroupsSTR")
if Session(strCookieURL & "strNTGroupsSTR") = "" then
Set strNTUserInfo = GetObject("WinNT://"+strNTUser)
For Each strNTUserInfoGroup in strNTUserInfo.Groups
strNTGroupsSTR=strNTGroupsSTR+", "+strNTUserInfoGroup.name
NEXT
Session(strCookieURL & "strNTGroupsSTR") = strNTGroupsSTR
end if
end if
if strAutoLogon="1" then
strNTUserFullName = Session(strCookieURL & "strNTUserFullName")
if Session(strCookieURL & "strNTUserFullName") = "" then
Set strNTUserInfo = GetObject("WinNT://"+strNTUser)
strNTUserFullName=strNTUserInfo.FullName
Session(strCookieURL & "strNTUserFullName") = strNTUserFullName
end if
end if
end sub
function chkDisplayForum(fForum_ID)
if (mlev = 4) then
chkDisplayForum= true
exit function
end if
'## Forum_SQL - load the user list
strSql = "SELECT " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " & strTablePrefix & "FORUM.F_PASSWORD_NEW "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE FORUM_ID = " & fForum_ID
set rsAccess = my_Conn.Execute(strSql)
select case rsAccess("F_PRIVATEFORUMS")
case 0, 1, 2, 3, 4, 7, 9
chkDisplayForum= true
exit function
case 5
UserNum = getNewMemberNumber()
if UserNum = - 1 then
chkDisplayForum= false
exit function
else
chkDisplayForum= true
exit function
end if
case 6
UserNum = getNewMemberNumber()
if UserNum = - 1 then
chkDisplayForum= false
exit function
end if
MatchFound = isAllowedMember(fForum_ID,UserNum)
if MatchFound = 1 then
chkDisplayForum= true
Else
chkDisplayForum= false
end if
case 8
chkDisplayForum= false
if strAuthType="nt" THEN
NTGroupSTR = Split(strNTGroupsSTR, ", ")
for j = 0 to ubound(NTGroupSTR)
NTGroupDBSTR = Split(rsAccess("F_PASSWORD_NEW"), ", ")
for i = 0 to ubound(NTGroupDBSTR)
if NTGroupDBSTR(i) = NTGroupSTR(j) then
chkDisplayForum= true
exit function
end if
next
next
End if
case else
chkDisplayForum= true
end select
end function
'##############################################
'## Cookie functions and Subs ##
'##############################################
sub DoCookies(fSavePassWord)
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
else
Response.Cookies(strUniqueID & "User").Path = "/"
end if
Response.Cookies(strUniqueID & "User")("Name") = strDBNTFUserName
Response.Cookies(strUniqueID & "User")("Pword") = Request.Form("Password")
Response.Cookies(strUniqueID & "User")("Cookies") = Request.Form("Cookies")
if fSavePassWord = "true" then
Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
end if
Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTFUserName)
end sub
sub ClearCookies()
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
else
Response.Cookies(strUniqueID & "User").Path = "/"
end if
Response.Cookies(strUniqueID & "User") = ""
'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust)
end sub
'##############################################
'## Do Counts ##
'##############################################
sub DoPCount()
'## Forum_SQL - Updates the totals Table
strSql ="UPDATE " & strTablePrefix & "TOTALS SET " & strTablePrefix & "TOTALS.P_COUNT = " & strTablePrefix & "TOTALS.P_COUNT + 1"
my_Conn.Execute (strSql)
end sub
sub DoTCount()
'## Forum_SQL - Updates the totals Table
strSql ="UPDATE " & strTablePrefix & "TOTALS SET " & strTablePrefix & "TOTALS.T_COUNT = " & strTablePrefix & "TOTALS.T_COUNT + 1"
my_Conn.Execute (strSql)
end sub
sub DoUCount(sUser_Name)
'## Forum_SQL - Update Total Post for user
strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " SET " & strMemberTablePrefix & "MEMBERS.M_POSTS = " & strMemberTablePrefix & "MEMBERS.M_POSTS + 1 "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & sUser_Name & "'"
'
my_Conn.Execute (strSql)
end sub
'##############################################
'## Private Forums ##
'##############################################
sub chkUser4()
if mLev = 4 then
exit sub
end if
'## Forum_SQL
strSql = "SELECT " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "FORUM.F_PASSWORD_NEW "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE " & strTablePrefix & "FORUM.Forum_ID = " & Request.QueryString("FORUM_ID")
set rsStatus = my_conn.Execute (strSql)
dim Users
If cint(rsStatus("F_PRIVATEFORUMS")) <> 0 then
Select case cint(rsStatus("F_PRIVATEFORUMS"))
case 0
'## Do Nothing
case 1, 6 '## Allowed Users
UserNum = getNewMemberNumber()
MatchFound = isAllowedMember(Request.QueryString("FORUM_ID"), cint(UserNum))
if MatchFound then
exit sub
else
doNotAllowed
Response.end
end if
case 2 '## password
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
'## OK
case else
if Request("pass") = "" then
doPasswordForm
Response.End
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
Response.Write "Invalid password! Back"
Response.End
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
end if
end if
end select
case 3 '## Either Password or Allowed
UserNum = getNewMemberNumber()
MatchFound = isAllowedMember(Request.QueryString("FORUM_ID"), cint(UserNum))
if MatchFound then
exit sub
else
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
'## OK
case else
if Request("pass") = "" then
doLoginForm
Response.End
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
Response.Write "Invalid password! Back"
Response.End
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
end if
end if
end select
end if
'## code added 07/13/2000
case 7 '## members or password
if (strDBNTUserName = "") then
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
'## OK
case else
if Request("pass") = "" then
doLoginForm
Response.End
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
Response.Write "Invalid password! Back"
Response.End
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
end if
end if
end select
end if
'## end code added 07/13/2000
case 4, 5 '## members only
if strDBNTUserName = "" then
doNotLoggedInForm
end if
case 8, 9
NTGroupSTR = Split(strNTGroupsSTR, ", ")
NTGroupDBSTR = Split(rsStatus("F_PASSWORD_NEW"), ", ")
For i = 0 to ubound(NTGroupDBSTR)
for j = 0 to ubound(NTGroupSTR)
if NTGroupDBSTR(i) = NTGroupSTR(j) then
exit SUB
end if
next
next
doNotAllowed
Response.end
case else
Response.Write " ERROR: Invalid forum type: " & rsStatus("F_PRIVATEFORUMS")
Response.end
end select
end if
'my_Conn.Close
'set my_Conn = nothing
end sub
function chkForumAccess(fForum)
if mLev = 4 then
chkForumAccess = true
exit function
end if
'## Forum_SQL
strSql = "SELECT " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "FORUM.F_PASSWORD_NEW "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE " & strTablePrefix & "FORUM.Forum_ID = " & fForum
set rsStatus = my_conn.Execute (strSql)
dim Users
dim MatchFound
If cint(rsStatus("F_PRIVATEFORUMS")) <> 0 then
Select case cint(rsStatus("F_PRIVATEFORUMS"))
case 0
chkForumAccess = true
case 1, 6 '## Allowed Users
UserNum = getNewMemberNumber()
' chkForumAccess = (isAllowedMember(fForum_ID,UserNum) = 1)
chkForumAccess = (isAllowedMember(fForum,UserNum) = 1)
case 2 '## password
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
chkForumAccess = true
case else
if Request("pass") = "" then
chkForumAccess = false
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
chkForumAccess = false
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
chkForumAccess = true
end if
end if
end select
case 3 '## Either Password or Allowed
UserNum = getNewMemberNumber()
' if countMembers(fForum) = 0 then
' chkForumAccess = false
' exit function
' end if
if isAllowedMember(fForum,UserNum) = 1 then
chkForumAccess = true
else
chkForumAccess = false
end if
if not(chkForumAccess) then
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
chkForumAccess = true
case else
if Request("pass") = "" then
chkForumAccess = false
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
chkForumAccess = false
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
chkForumAccess = true
end if
end if
end select
end if
'## code added 07/13/2000
case 7 '## members or password
if strDBNTUserName = "" then
select case Request.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT"))
case rsStatus("F_PASSWORD_NEW")
chkForumAccess = true
case else
if Request("pass") = "" then
chkForumAccess = false
else
if Request("pass") <> rsStatus("F_PASSWORD_NEW") then
chkForumAccess = false
else
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
end if
Response.Cookies(strUniqueID & "User")("PRIVATE_" & rsStatus("F_SUBJECT")) = Request("pass")
chkForumAccess = true
end if
end if
end select
end if
'## end code added 07/13/2000
case 4, 5 '## members only
if strDBNTUserName = "" then
chkForumAccess = false
else 'V3.1 SR4
chkForumAccess = true
end if
case 8, 9
test="test db"
chkForumAccess = FALSE
if strAuthType="db" then
chkForumAccess = true
exit function
end if
NTGroupSTR = Split(strNTGroupsSTR, ", ")
for j = 0 to ubound(NTGroupSTR)
NTGroupDBSTR = Split(rsStatus("F_PASSWORD_NEW"), ", ")
for i = 0 to ubound(NTGroupDBSTR)
if NTGroupDBSTR(i) = NTGroupSTR(j) then
chkForumAccess = True
exit function
end if
next
next
case else
chkForumAccess = true
end select
else
chkForumAccess = true
end if
end function
function chkAccess(fForum)
if mLev = 4 then
chkAccess = true
exit function
end if
'## Forum_SQL - load the user list
strSql = "SELECT " & strTablePrefix & "FORUM.F_PRIVATEFORUMS FROM " & strTablePrefix & "FORUM WHERE FORUM_ID = " & fForum
set rsAccess = my_Conn.Execute(strSql)
if rsAccess("F_PRIVATEFORUMS") <> 1 then
chkAccess = true
exit function
end if
if Request.Cookies(strUniqueID & "User")("Name") = "" then
chkAccess = false
end if
'get the member number
UserNum = getMemberNumber(Request.Cookies(strUniqueID & "User")("Name"))
' if isAllowedMember(fForum_ID,UserNum) = 1 then
if isAllowedMember(fForum,UserNum) = 1 then 'V3.1 SR4
chkAccess = true
else
chkAccess = false
end if
End function
sub doLoginForm()
%>
There Was A Problem
You do not have access to this forum.
>If you have been given special permission by the administrator to view and/or post in this forum, enter the password here: