Originally posted by CarefreeI meant FORUM oops. I'll have time next Thursday to work on it if you don't get there first.<
Let's not go all the way to topic level, age-restricting by forum is sufficient. I'd rather avoid the unnecessary labor of having to set age limits on each/every post. There's already a minimum age for registration, but it leaves a gap for the teen-aged minors (which I'd rather not fill by a visit to the Feds explaining why some sick pervert was using my board to reach teeny-boppers).
Function DisplayUsersAge(fDOB)
dtDOB = fDOB
dtToday = FormatDateTime(strForumTimeAdjust,2)
DisplayUsersAge = DateDiff("yyyy", dtDOB, dtToday)
dtTmp = DateAdd("yyyy", DisplayUsersAge, dtDOB)
if (DateDiff("d", dtToday, dtTmp) > 0) then DisplayUsersAge = DisplayUsersAge - 1
End Function
function DOBToDate(fDOB)
'Testing for server format
if strComp(Month("04/05/2002"),"4") = 0 then
DOBToDate = cdate("" & Mid(fDOB, 5,2) & "/" & Mid(fDOB, 7,2) & "/" & Mid(fDOB, 1,4) & "")
else
DOBToDate = cdate("" & Mid(fDOB, 7,2) & "/" & Mid(fDOB, 5,2) & "/" & Mid(fDOB, 1,4) & "")
end if
end function
' ############################# User Group Age Check Mod #############################
strSQL = "SELECT M_NAME, MEMBER_ID, M_DOB FROM " & strTablePrefix & "MEMBERS " & _
"WHERE MEMBER_ID = " & MemberID
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if not rsAdult.EOF then
Member_DOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(Member_DOB), Date)
end if
rsAdult.close
set rsAdult = Nothing
strSql = "SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUP_USERS " &_
"WHERE MEMBER_ID = " & MemberID
Set rsGroups = Server.CreateObject("ADODB.Recordset")
rsGroups.open strSql, my_Conn
rsGroups.close
set rsGroups = Nothing
if USERGROUP_ID = 8 then
if MMAge > 20 then
USERGROUP_ID = 7
MEMBER_TYPE = 1
strSql = "UPDATE " & strTablePrefix & "USERGROUP_USERS " &_
"(USERGROUP_ID, MEMBER_ID, MEMBER_TYPE) VALUES " &_
"WHERE MEMBER_ID = " & MemberID
set rsClr = Server.CreateObject("ADODB.Recordset")
rsClr.open strSql, my_Conn
rsClr.close
set rsClr = Nothing
end if
end if
' ############################# User Group Age Check Mod End #########################
strSql = "SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUP_USERS " &_
"WHERE MEMBER_ID = " & MemberID
Set rsGroups = Server.CreateObject("ADODB.Recordset")
rsGroups.open strSql, my_Conn
if rsGroups.EOF or rsGroups.BOF then
'some error msg
else
USERGROUP_ID = rsGroups("USERGROUP_ID")
end if
rsGroups.close
set rsGroups = Nothing
strSQL = "SELECT M_DOB FROM " & strTablePrefix & "MEMBERS_PENDING " & _
"WHERE M_NAME = '" & strNewMemberName & "'"
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if not rsAdult.EOF then
Member_DOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(Member_DOB), Date)
end if
rsAdult.close
set rsAdult = Nothing
if MMAge < 21 then
USERGROUP_ID = 8
MEMBER_TYPE = 1
set rsClr = my_Conn.execute(strSql)
if not rsClr.BOF and not rsClr.EOF then
strSql = "INSERT INTO " & strTablePrefix & "USERGROUP_USERS " &_
"(USERGROUP_ID, MEMBER_ID, MEMBER_TYPE) VALUES "
myConn.execute(strSql)
end if
rsClr.close
set rsClr = Nothing
else
strSQL = "SELECT MEMBER_ID, M_KEY, M_DOB FROM " & strMemberTablePrefix & "MEMBERS_PENDING " & _
" WHERE M_KEY = '" & key & "'"
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if rsAdult.EOF or rsAdult.BOF then
'do nothing
else
MDOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(MDOB), Date)
end if
rsAdult.close
set rsAdult = Nothing