<% function GetUID(ByRef pobjCon) dim rstUser, intUserID, blnOptCollapse intUserID = 0 if CLng(session(cLICENSE_ID & "UID"))>0 then intUserID = CLng(session(cLICENSE_ID & "UID")) 'user already logged in else 'user not logged in - check for autologin if Request.Cookies(cLICENSE_ID & "aspfastforum")("autologin")="yes" then 'cookies for autologin are set - try to autologin user set rstUser = GetUserForLogin(pobjCon, Request.cookies(cLICENSE_ID & "aspfastforum")("email"), Request.cookies(cLICENSE_ID & "aspfastforum")("password")) if not rstUser.EOF then if rstUser.Fields.Item("isBanned").Value then call RaiseError(STR_ERROR_BANNED) blnOptCollapse = rstUser.Fields.Item("optCollapseThreads").Value intUserID = CLng(rstUser.Fields.Item("ID").Value) end if rstUser.close set rstUser = Nothing else 'check for foreignID login if session("FORUM_ID")="" or Trim(session("FORUM_name"))="" or Trim(session("FORUM_email"))="" or session("FORUM_password")="" then 'user can not be logged in automatically - no foreign ID set intUserID = 0 else 'get user for foreign ID set rstUser = GetUserForForeignID(pobjCon, session("FORUM_ID")) if rstUser.EOF then rstUser.close set rstUser = Nothing 'if user does not exist for foreign ID then insert new user intUserID = AddUser(pobjCon, Trim(session("FORUM_name")), Trim(session("FORUM_email")), session("FORUM_password"), session("FORUM_ID"), false) 'false=not a test user blnOptCollapse = false else if rstUser("isBanned") then call RaiseError(STR_ERROR_BANNED) blnOptCollapse = rstUser.Fields.Item("optCollapseThreads").Value intUserID = CLng(rstUser.Fields.Item("ID").Value) 'if the user has changed name or email then update them in the forum database if Trim(session("FORUM_name"))<>rstUser.Fields.Item("Name").Value or Trim(session("FORUM_email"))<>rstUser.Fields.Item("Email").Value then call UpdUserProfile(pobjCon, intUserID, Trim(session("FORUM_name")), Trim(session("FORUM_email")), session("FORUM_password")) end if rstUser.close set rstUser = Nothing end if if intUserID<=0 then 'we could not log in with that foreign ID '(should never happen but just in case we want to avoid endless redirects) session("FORUM_ID")="" session("FORUM_name")="" session("FORUM_email")="" session("FORUM_password")="" end if end if end if if intUserID>0 then session(cLICENSE_ID & "UID") = intUserID if blnOptCollapse then Response.Cookies("t") = "collapsed" else Response.Cookies("t") = "" end if call UpdUserWithLastLogin(pobjCon, intUserID) 'set cookies for user permissions call SetUserPermissionCookies(pobjCon, intUserID) end if end if GetUID = CLng(intUserID) end function %>