The query within this function is executed even when a user is not logged in. Add the statements in red as shown. Prevents two unneccessary calls to database.
function ReadLastHereDate(UserName)
dim rs_date
dim strSql
if Trim(UserName) = "" then
ReadLastHereDate = DateToStr(DateAdd("d", -10, strForumTimeAdjust))
exit function
end if
'## Forum_SQL
strSql = "SELECT M_LASTHEREDATE "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' "
Set rs_date = Server.CreateObject("ADODB.Recordset")
rs_date.open strSql, my_Conn
if (rs_date.BOF and rs_date.EOF) then
ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust))
else
if rs_date("M_LASTHEREDATE") = "" or IsNull(rs_date("M_LASTHEREDATE")) then
ReadLastHereDate = DateToStr(DateAdd("d", -10, strForumTimeAdjust))
else
ReadLastHereDate = rs_date("M_LASTHEREDATE")
end if
end if
rs_date.close
set rs_date = nothing
UpdateLastHereDate DateToStr(strForumTimeAdjust), UserName
end function