📄 inc_func_common.asp
字号:
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
'##############################################
'## 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") = strEncodedPassword
'Response.Cookies(strUniqueID & "User")("Cookies") = Request.Form("Cookies")
if fSavePassWord = "true" then
Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", intCookieDuration, 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") = ""
Session(strCookieURL & "Approval") = ""
Session.Abandon
'Response.Cookies(strUniqueID & "User").Expires = dateadd("d", -2, strForumTimeAdjust)
end sub
'##############################################
'## Private Forums ##
'##############################################
function chkUser(fName, fPassword, fAuthor)
dim rsCheck
dim strSql
'## Forum_SQL
strSql = "SELECT MEMBER_ID, M_LEVEL, M_NAME, M_PASSWORD "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(fName, "SQLString") & "' "
if strAuthType="db" then
strSql = strSql & " AND M_PASSWORD = '" & ChkString(fPassword, "SQLString") &"'"
End If
strSql = strSql & " AND M_STATUS = " & 1
Set rsCheck = my_Conn.Execute(strSql)
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
MemberID = -1
chkUser = 0 '## Invalid Password
if strDBNTUserName <> "" and chkCookie = 1 then
Call ClearCookies()
strDBNTUserName = ""
end if
else
MemberID = rsCheck("MEMBER_ID")
if (rsCheck("MEMBER_ID") & "" = fAuthor & "") and (cLng(rsCheck("M_LEVEL")) <> 3) then
chkUser = 1 '## Author
else
select case cLng(rsCheck("M_LEVEL"))
case 1
chkUser = 2 '## Normal User
case 2
chkUser = 3 '## Moderator
case 3
chkUser = 4 '## Admin
case else
chkUser = cLng(rsCheck("M_LEVEL"))
end select
end if
end if
rsCheck.close
set rsCheck = nothing
end function
Function ReplaceURLs(ByVal strToFormat)
Dim oTag, c1Tag, oTag2, c2Tag
Dim roTag, rc1Tag, rc2Tag
Dim oTagPos, c1TagPos, oTagPos2, c1TagPos2
Dim Counter
Dim strArray, strArray2
Dim strFirstPart, strSecondPart
oTag = "[url="""
c1Tag = """]"
oTag2 = "[url]"
c2Tag = "[/url]"
roTag = "<a href="""
rc1Tag = """ target=""_blank"">"
rc2Tag = "</a>"
oTagPos = InStr(1, strToFormat, oTag, 1) 'Position of opening tag
c1TagPos = InStr(1, strToFormat, c1Tag, 1) 'Position of closing tag
'if opening tag and closing tag is found...
If (oTagpos > 0) And (c1TagPos > 0) Then
'Split string at the opening tag
strArray = Split(strToFormat, oTag, -1, 1)
'Loop through array
For Counter = 0 To UBound(strArray)
'if the closing tag is found in the string then...
If (InStr(1, strArray(Counter), c1Tag, 1) > 0) Then
'split string at the closing tag...
strArray2 = Split(strArray(Counter), c1Tag, -1, 1)
strArray2(0) = replace(strArray2(0), """", " ") ' ## filter out "
'strArray2(0) = replace(strArray2(0), "&", " ", 1, -1, 1) ' ## filter out &
'strArray2(0) = replace(strArray2(0), "#", " ", 1, -1, 1) ' ## filter out #
strArray2(0) = replace(strArray2(0), ";", " ", 1, -1, 1) ' ## filter out ;
strArray2(0) = replace(strArray2(0), "+", " ", 1, -1, 1) ' ## filter out +
strArray2(0) = replace(strArray2(0), "(", " ", 1, -1, 1) ' ## filter out (
strArray2(0) = replace(strArray2(0), ")", " ", 1, -1, 1) ' ## filter out )
'strArray2(0) = replace(strArray2(0), "[", " ", 1, -1, 1) ' ## filter out [
'strArray2(0) = replace(strArray2(0), "]", " ", 1, -1, 1) ' ## filter out ]
'strArray2(0) = replace(strArray2(0), "=", " ", 1, -1, 1) ' ## filter out =
strArray2(0) = replace(strArray2(0), "*", " ", 1, -1, 1) ' ## filter out *
strArray2(0) = replace(strArray2(0), "'", " ", 1, -1, 1) ' ## filter out '
strArray2(0) = replace(strArray2(0), ">", " ", 1, -1, 1) ' ## filter out >
strArray2(0) = replace(strArray2(0), "<", " ", 1, -1, 1) ' ## filter out <
strArray2(0) = replace(strArray2(0), vbTab, " ", 1, -1, 1) ' ## filter out Tabs
strArray2(0) = replace(strArray2(0), "view-source", " ", 1, -1, 1) ' ## filter out view-source
strArray2(0) = replace(strArray2(0), "javascript", " ", 1, -1, 1) ' ## filter out javascript
strArray2(0) = replace(strArray2(0), "jscript", " ", 1, -1, 1) ' ## filter out jscript
strArray2(0) = replace(strArray2(0), "vbscript", " ", 1, -1, 1) ' ## filter out vbscript
'if the closing url tag is found in the string and
'[URL] is not found in the string then...
If InStr(1, strArray2(1), c2Tag, 1) And _
Not InStr(1, UCase(strArray2(1)), "[URL]", 1) Then
strFirstPart = Left(strArray2(1), InStr(1, strArray2(1), c2Tag, 1)-1)
strSecondPart = Right(strArray2(1), (Len(strArray2(1)) - Instr(1, strArray2(1), c2Tag,1) - len(c2Tag)+1))
If strFirstPart <> "" Then
If UCase(Left(strFirstPart, 5)) = "[IMG]" Then
ReplaceURLs = ReplaceURLs & "<a href=""" & strArray2(0) & """ target=""_blank"">" & strFirstPart & "</a>" & strSecondPart
ElseIf UCase(Left(strArray2(0), 7)) = "HTTP://" Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 1) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 8)) = "HTTPS://" Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 2) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 4)) = "WWW." Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 3) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & "http://" & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 7)) = "MAILTO:" Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 6)) = "FTP://" Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 5) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf InStr(strArray2(0), "@") > 0 Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strSecondPart
ReplaceURLs = ReplaceURLs & roTag & "mailto:" & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 6)) = "FILE:///" Then
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
Else
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
End If
Else
If UCase(Left(strArray2(0), 7)) = "HTTP://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 1) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 8)) = "HTTPS://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 2) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 4)) = "WWW." Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 3) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & "http://" & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 7)) = "MAILTO:" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 6)) = "FTP://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 5) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf InStr(strArray2(0), "@") > 0 Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strSecondPart
'ReplaceURLs = ReplaceURLs & roTag & "mailto:" & strArray2(0) & rc1Tag & strFirstPart & rc2Tag & strSecondPart
ElseIf UCase(Left(strArray2(0), 6)) = "FILE:///" Then
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strSecondPart
Else
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strSecondPart
End If
End If
Else
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strArray2(1)
End If
Else
ReplaceURLs = ReplaceURLs & strArray(Counter)
End If
Next
Else
ReplaceURLs = strToFormat
End If
oTagPos2 = InStr(1, ReplaceURLs, oTag2, 1)
c1TagPos2 = InStr(1, ReplaceURLs, c2Tag, 1)
'if opening tag and closing tag is found then...
If (oTagpos2 > 0) And (c1TagPos2 > 0) Then
'split string at opening tag
strArray = Split(ReplaceURLs, oTag2, -1, 1)
ReplaceURLs = ""
For Counter = 0 To Ubound(strArray)
'if closing url tag is found in string then...
If InStr(1, strArray(Counter), c2Tag, 1) > 0 Then
'split string at closing url tag
strArray2 = Split(strArray(Counter), c2Tag, -1, 1)
strArray2(0) = replace(strArray2(0), """", " ") ' ## filter out "
'strArray2(0) = replace(strArray2(0), "&", " ", 1, -1, 1) ' ## filter out &
'strArray2(0) = replace(strArray2(0), "#", " ", 1, -1, 1) ' ## filter out #
strArray2(0) = replace(strArray2(0), ";", " ", 1, -1, 1) ' ## filter out ;
strArray2(0) = replace(strArray2(0), "+", " ", 1, -1, 1) ' ## filter out +
strArray2(0) = replace(strArray2(0), "(", " ", 1, -1, 1) ' ## filter out (
strArray2(0) = replace(strArray2(0), ")", " ", 1, -1, 1) ' ## filter out )
'strArray2(0) = replace(strArray2(0), "[", " ", 1, -1, 1) ' ## filter out [
'strArray2(0) = replace(strArray2(0), "]", " ", 1, -1, 1) ' ## filter out ]
'strArray2(0) = replace(strArray2(0), "=", " ", 1, -1, 1) ' ## filter out =
strArray2(0) = replace(strArray2(0), "*", " ", 1, -1, 1) ' ## filter out *
strArray2(0) = replace(strArray2(0), "'", " ", 1, -1, 1) ' ## filter out '
strArray2(0) = replace(strArray2(0), ">", " ", 1, -1, 1) ' ## filter out >
strArray2(0) = replace(strArray2(0), "<", " ", 1, -1, 1) ' ## filter out <
strArray2(0) = replace(strArray2(0), vbTab, " ", 1, -1, 1) ' ## filter out Tabs
strArray2(0) = replace(strArray2(0), "view-source", " ", 1, -1, 1) ' ## filter out view-source
strArray2(0) = replace(strArray2(0), "javascript", " ", 1, -1, 1) ' ## filter out javascript
strArray2(0) = replace(strArray2(0), "jscript", " ", 1, -1, 1) ' ## filter out jscript
strArray2(0) = replace(strArray2(0), "vbscript", " ", 1, -1, 1) ' ## filter out vbscript
If UCase(Left(strArray2(0), 7)) = "HTTP://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 1) & strArray2(1)
ElseIf UCase(Left(strArray2(0), 8)) = "HTTPS://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 2) & strArray2(1)
ElseIf UCase(Left(strArray2(0), 4)) = "WWW." Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 3) & strArray2(1)
ElseIf UCase(Left(strArray2(0), 7)) = "MAILTO:" Then
'ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strArray2(1)
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strArray2(1)
ElseIf UCase(Left(strArray2(0), 6)) = "FTP://" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 5) & strArray2(1)
ElseIf InStr(strArray2(0), "@") > 0 Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 4) & strArray2(1)
ElseIf UCase(Left(strArray2(0), 6)) = "FILE:///" Then
ReplaceURLs = ReplaceURLs & edit_hrefs(strArray2(0), 7) & strArray2(1)
Else
ReplaceURLs = ReplaceURLs & roTag & strArray2(0) & rc1Tag & strArray2(0) & rc2Tag & strArray2(1)
End If
Else
ReplaceURLs = ReplaceURLs & strArray(Counter)
End If
Next
End If
End Function
function isAllowedMember(fForum_ID,fMemberID)
if fMemberID <> MemberID then
isAllowedMember = OldisAllowedMember(fForum_ID,fMemberID)
exit function
end if
if Session(strCookieURL & "AllowedForums" & MemberID) = "" or IsNull(Session(strCookieURL & "AllowedForums" & MemberID)) then
strSql = "SELECT FORUM_ID FROM " & strTablePrefix & "ALLOWED_MEMBERS "
strSql = strSql & " WHERE MEMBER_ID = " & cLng(fMemberID)
Set rsAllowedMember = Server.CreateObject("ADODB.Recordset")
rsAllowedMember.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if (rsAllowedMember.EOF or rsAllowedMember.BOF) then
isAllowedMember2 = "-1"
Session(strCookieURL & "AllowedForums" & MemberID) = isAllowedMember2
Session(strCookieURL & "AllowedForums" & MemberID) = isAllowedMember2
else
arrAllowedForums = rsAllowedMember.GetRows(adGetRowsRest)
For AllowCount = 0 to ubound(arrAllowedForums,2) ' Total Numer of Rows
if AllowCount = 0 then
isAllowedMember2 = arrAllowedForums(0,AllowCount)
else
isAllowedMember2 = isAllowedMember2 & "," & arrAllowedForums(0,AllowCount)
end if
next
Session(strCookieURL & "AllowedForums" & MemberID) = isAllowedMember2
Session(strCookieURL & "AllowedForums" & MemberID) = isAllowedMember2
end if
rsAllowedMember.close
set rsAllowedMember = nothing
end if
if Session(strCookieURL & "AllowedForums" & MemberID) = "-1" then
isAllowedMember = 0
elseif InStr("," & Session(strCookieURL & "AllowedForums" & MemberID) & ",","," & fForum_ID & ",") then
isAllowedMember = 1
else
isAllowedMember = 0
end if
end function
function OldisAllowedMember(fForum_ID,fMemberID)
OldisAllowedMember = 0
strSql = "SELECT MEMBER_ID, FORUM_ID FROM " & strTablePrefix & "ALLOWED_MEMBERS "
strSql = strSql & " WHERE FORUM_ID = " & cLng(fForum_ID)
strSql = strSql & " AND MEMBER_ID = " & cLng(fMemberID)
Set rsAllowedMember = Server.CreateObject("ADODB.Recordset")
rsAllowedMember.open strSql, my_Conn
if (rsAllowedMember.EOF or rsAllowedMember.BOF) then
OldisAllowedMember = 0
rsAllowedMember.close
set rsAllowedMember = nothing
exit function
else
OldisAllowedMember = 1
rsAllowedMember.close
set rsAllowedMember = nothing
end if
end function
Function ReplaceImageTags(fString)
Dim oTag, cTag
Dim roTag, rcTag
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2, counter3
Dim strUrlText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 6
Dim ImgTags(6,2,2)
Dim strArray, strArray2
ImgTags(1,1,1) = "[img]"
ImgTags(1,2,1) = "[/img]"
ImgTags(1,1,2) = "<img src="""
ImgTags(1,2,2) = """ border=""0"">"
ImgTags(2,1,1) = "[image]"
ImgTags(2,2,1) = "[/image]"
ImgTags(2,1,2) = ImgTags(1,1,2)
ImgTags(2,2,2) = ImgTags(1,2,2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -