!--#Include File="bbs/inc/Dv_ClsMain.asp"--> % Function CheckUserLogin() Dim Dvbbs,UserSession Const MsxmlVersion=".3.0" Set Dvbbs = New Cls_Forum Set UserSession=Server.CreateObject("msxml2.FreeThreadedDOMDocument" MsxmlVersion) If UserSession.loadxml(Session(Dvbbs.CacheName "UserID")"") Then If UserSession.documentElement.selectSingleNode("userinfo/@userid").text>"0" Then '在论坛登录成功 CheckUserLogin = True '下边是用户一些信息的获取方法,可自行将其保存于Cookies或Session中便于使用: '用户ID : UserSession.documentElement.selectSingleNode("userinfo/@userid").text '用户名 : UserSession.documentElement.selectSingleNode("userinfo/@username").text '生日 : UserSession.documentElement.selectSingleNode("userinfo/@userbirthday").text '电子邮箱 : UserSession.documentElement.selectSingleNode("userinfo/@useremail").text '性别 : UserSession.documentElement.selectSingleNode("userinfo/@usersex").text '0为女,1为男 '注册时间 : UserSession.documentElement.selectSingleNode("userinfo/@joindate").text '最后登录 : UserSession.documentElement.selectSingleNode("userinfo/@lastlogin").text '登录次数 : UserSession.documentElement.selectSingleNode("userinfo/@userlogins").text '金钱 : UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text '积分 : UserSession.documentElement.selectSingleNode("userinfo/@userep").text '魅力 : UserSession.documentElement.selectSingleNode("userinfo/@usercp").text '最后登录IP : UserSession.documentElement.selectSingleNode("userinfo/@userlastip").text '浏览器类型 : UserSession.documentElement.selectSingleNode("agent/@browser").text '浏览器版本 : UserSession.documentElement.selectSingleNode("agent/@version").text '操作系统 : UserSession.documentElement.selectSingleNode("agent/@platform").text '来访IP : UserSession.documentElement.selectSingleNode("agent/@ip").text '举例应用: Response.Cookies("username") = UserSession.documentElement.selectSingleNode("userinfo/@username").text Response.Cookies("joindate") = UserSession.documentElement.selectSingleNode("userinfo/@joindate").text If UserSession.documentElement.selectSingleNode("userinfo/@usersex").text="0" Then Response.Cookies("sex") = "靓妹" Else Response.Cookies("sex") = "酷哥" End if Response.Cookies("lastlogin") = UserSession.documentElement.selectSingleNode("userinfo/@lastlogin").text Response.Cookies("userlogins") = UserSession.documentElement.selectSingleNode("userinfo/@userlogins").text Response.Cookies("browser") = UserSession.documentElement.selectSingleNode("agent/@browser").text Response.Cookies("version") = UserSession.documentElement.selectSingleNode("agent/@version").text Response.Cookies("platform") = UserSession.documentElement.selectSingleNode("agent/@platform").text Else '访问过论坛尚未登录,为来宾状态 CheckUserLogin = False End if Else '未访问过论坛 CheckUserLogin = False End if Set UserSession = nothing Set Dvbbs = nothing End Function %>
3.bbs/login.asp新增红色部分,使在站点首页登录成功后仍能返回首页:
Dim comeurlname If instr(lcase(request("comeurl")),"reg.asp")>0 or instr(lcase(request("comeurl")),"login.asp")>0 or trim(request("comeurl"))="" Then comeurlname="" comeurl="index.asp" Else comeurl=request("comeurl") comeurlname="li>a href="request("comeurl")">"request("comeurl")"/a>/li>" End If
If request("back")="1" Then Response.Redirect("../index.asp") End If
Dim TempStr TempStr = template.html(2) 'If Dvbbs.Forum_ChanSetting(0)=1 And Dvbbs.Forum_ChanSetting(10)=1 And Dvbbs.Forum_ChanSetting(12)=1 Then ' TempStr = Replace(TempStr,"{$ray_logininfo}",template.html(3)) 'Else ' TempStr = Replace(TempStr,"{$ray_logininfo}","") 'End If '----------------------------------------------------------------- '系统整合 '----------------------------------------------------------------- If DvApi_Enable Then Response.Write DvApi_SaveCookie Response.Flush End If '----------------------------------------------------------------- TempStr = Replace(TempStr,"{$ray_logininfo}","") TempStr = Replace(TempStr,"{$comeurl}",comeurl) TempStr = Replace(TempStr,"{$comeurlinfo}",comeurlname) TempStr = Replace(TempStr,"{$forumname}",Dvbbs.Forum_Info(0)) Response.Write TempStr TempStr="" End Function
4.bbs/logout.asp新增红色部分,使在站点首页点退出登录后仍能返回首页:
'----------------------------------------------------------------- '系统整合 '----------------------------------------------------------------- Dim DvApi_Obj,DvApi_SaveCookie,SysKey If DvApi_Enable Then Md5OLD = 1 SysKey = Md5(Dvbbs.MemberNameDvApi_SysKey,16) Md5OLD = 0 Set DvApi_Obj = New DvApi DvApi_SaveCookie = DvApi_Obj.SetCookie(SysKey,Dvbbs.MemberName,"","") Set DvApi_Obj = Nothing Response.Write DvApi_SaveCookie Response.Flush End If
If request("back")="1" Then Response.Redirect("../index.asp") End If