<!--#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.MemberName&DvApi_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