如何判断oblog4.X中用户是否登陆,以及获取登陆后的信息。 30
我问一下,就是我现在想把自己的程序和oblog4.5结合起来,就是说登陆了oblog4.5之后,让自己同时也登陆我的程序,请问各位该怎么弄呢?因为,我在oblog4.5的...
我问一下,就是我现在想把自己的程序和oblog4.5结合起来,就是说登陆了oblog4.5之后,让自己同时也登陆我的程序,请问各位该怎么弄呢?因为,我在oblog4.5的页面里面找登陆的根据,但是始终找不到!不知道到底是根据cookie还是其他的全局变量呢?成功判断用户已经登陆,该怎么获取用户信息?
希望能详细一点!! 展开
希望能详细一点!! 展开
2个回答
展开全部
与登陆有关的代码
不知道怎么用
class_sys.asp关于判断登陆的代码,但是不知道怎么应用到自己的程序中去。
Public Function CheckUserLogined()
On Error Resume Next
Dim Logined, rsLogin, sqlLogin, sSql, user_info ,tLogined ,i
Logined = True
l_uName = filt_badstr(DecodeCookie(request.Cookies(cookies_name)("username")))
l_uPass = filt_badstr(DecodeCookie(request.Cookies(cookies_name)("password")))
If l_uName = "" Then
Logined = False
End If
If l_uPass = "" Then
Logined = False
End If
sSql = "userid,user_level,user_showlogword_num,user_upfiles_max,user_upfiles_size,user_dir,isubbedit,user_domain,"
sSql = sSql &"user_domainroot,lockuser,user_folder,adddate,user_info,user_Icon1,user_Icon2,user_group,lastcomment,"
sSql = sSql &"lastmessage,scores,Nickname,comment_count,message_count,newbie,lastlogintime,log_count,user_siterefu_num" & str_domain
If Logined = True Then
If Session ("CheckUserLogined") = "" Then
'除了str_domain,0-25列
sqlLogin = "select " & sSql & " from oblog_user where lockuser=0 and Username='" & l_uName & "' and Password='" & l_uPass & "' And isdel=0 "
Set rsLogin = Execute(sqlLogin)
If rsLogin.EOF Then
CheckUserLogined = False
Exit Function
Else
If rsLogin(9) = 1 Then
Set rsLogin = Nothing
adderrstr ("当前用户已被系统锁定,无法进行操作,请联系管理员!")
showerr
End If
For i = 0 To 25
tLogined = tLogined & "$$$" & rsLogin(i)
Next
tLogined = Replace (tLogined,"$$$","",1,1,0)
' tLogined = Right (tLogined,Len(tLogined)-3)
If str_domain <> "" Then tLogined = tLogined & "$$$" &rsLogin("custom_domain")
Session ("CheckUserLogined") = tLogined
End If
End If
tLogined = Session ("CheckUserLogined")
tLogined = Split (tLogined,"$$$")
' Response.Write tLogined(18)
' Response.Write tLogined(19)
' Response.Write tLogined(20)
' Response.Write UBound(tLogined)
If UBound(tLogined) > 26 Or UBound(tLogined) = -1 Then
Session ("CheckUserLogined") = ""
Response.Redirect (blogurl & "login.asp")
Exit Function
End if
l_uId = Int(tLogined(0))
l_ulevel = Int(tLogined(1))
l_uShowlogWord = Int(tLogined(2))
l_uDir = tLogined(5)
l_isUbb = Int(tLogined(6))
l_uDomain = tLogined(7) & "." & tLogined(8)
l_uFolder = tLogined(10)
l_uGroupId=Int(tLogined(15))
l_uUpUsed=Int(tLogined(4))
l_uLastComment=tLogined(16)
l_uLastMessage=tLogined(17)
l_uScores=Int(tLogined(18))
l_uNickname=tLogined(19)
l_uCommentCount=Int(tLogined(20))
l_uMessageCount=Int(tLogined(21))
If l_uNickname="" Then l_uNickname=l_uName
If InStr(tLogined(11), "$") Then
user_info = Split(tLogined(11), "$")
l_uFrame = user_info(1)
Else
l_uFrame = 1
End If
If true_domain = 1 Then
'判断用户绑定的顶级域名
l_ucustomdomain = tLogined(26)
If l_ucustomdomain <> "" Then
l_uDomain = l_ucustomdomain
End If
End If
l_uNewBie=Int(tLogined(22))
l_uIco=ProIco(tLogined(13), 1)
l_uLastLogin=tLogined(23)
l_ulogcount=Int(tLogined(24))
l_uvisitcount=Int(tLogined(25))
l_uAddtime=tLogined(11)
If IsNumeric(l_uGroupId) Then
'获得组信息
GetGroupInfo
'判断
Set rsLogin=Execute("Select top 1 groupid,g_points,g_autoupdate From oblog_groups Where g_level>" & l_Group(2,0) & " Order By g_level")
If Not rsLogin.Eof Then
If rsLogin("g_autoupdate")=1 Then
'判断是否需要升级
If l_uScores>=Int(rsLogin(1)) Then
Execute ("update oblog_groups set g_members=g_members-1 WHERE groupid = " &l_uGroupId)
Execute ("Update oblog_user Set user_group=" & rsLogin(0) & " Where userid=" & l_uid)
Execute ("update oblog_groups set g_members=g_members+1 WHERE groupid = " &rsLogin(0))
Call GetGroupInfo
'用户升级后需重新载入Session
Session ("CheckUserLogined") = ""
End If
End If
End If
End If
Set rsLogin = Nothing
End If
If Err Then
Err.Clear
Session ("CheckUserLogined") = ""
Logined = False
Response.Redirect (blogurl & "login.asp")
End if
CheckUserLogined = Logined
End Function
不知道怎么用
class_sys.asp关于判断登陆的代码,但是不知道怎么应用到自己的程序中去。
Public Function CheckUserLogined()
On Error Resume Next
Dim Logined, rsLogin, sqlLogin, sSql, user_info ,tLogined ,i
Logined = True
l_uName = filt_badstr(DecodeCookie(request.Cookies(cookies_name)("username")))
l_uPass = filt_badstr(DecodeCookie(request.Cookies(cookies_name)("password")))
If l_uName = "" Then
Logined = False
End If
If l_uPass = "" Then
Logined = False
End If
sSql = "userid,user_level,user_showlogword_num,user_upfiles_max,user_upfiles_size,user_dir,isubbedit,user_domain,"
sSql = sSql &"user_domainroot,lockuser,user_folder,adddate,user_info,user_Icon1,user_Icon2,user_group,lastcomment,"
sSql = sSql &"lastmessage,scores,Nickname,comment_count,message_count,newbie,lastlogintime,log_count,user_siterefu_num" & str_domain
If Logined = True Then
If Session ("CheckUserLogined") = "" Then
'除了str_domain,0-25列
sqlLogin = "select " & sSql & " from oblog_user where lockuser=0 and Username='" & l_uName & "' and Password='" & l_uPass & "' And isdel=0 "
Set rsLogin = Execute(sqlLogin)
If rsLogin.EOF Then
CheckUserLogined = False
Exit Function
Else
If rsLogin(9) = 1 Then
Set rsLogin = Nothing
adderrstr ("当前用户已被系统锁定,无法进行操作,请联系管理员!")
showerr
End If
For i = 0 To 25
tLogined = tLogined & "$$$" & rsLogin(i)
Next
tLogined = Replace (tLogined,"$$$","",1,1,0)
' tLogined = Right (tLogined,Len(tLogined)-3)
If str_domain <> "" Then tLogined = tLogined & "$$$" &rsLogin("custom_domain")
Session ("CheckUserLogined") = tLogined
End If
End If
tLogined = Session ("CheckUserLogined")
tLogined = Split (tLogined,"$$$")
' Response.Write tLogined(18)
' Response.Write tLogined(19)
' Response.Write tLogined(20)
' Response.Write UBound(tLogined)
If UBound(tLogined) > 26 Or UBound(tLogined) = -1 Then
Session ("CheckUserLogined") = ""
Response.Redirect (blogurl & "login.asp")
Exit Function
End if
l_uId = Int(tLogined(0))
l_ulevel = Int(tLogined(1))
l_uShowlogWord = Int(tLogined(2))
l_uDir = tLogined(5)
l_isUbb = Int(tLogined(6))
l_uDomain = tLogined(7) & "." & tLogined(8)
l_uFolder = tLogined(10)
l_uGroupId=Int(tLogined(15))
l_uUpUsed=Int(tLogined(4))
l_uLastComment=tLogined(16)
l_uLastMessage=tLogined(17)
l_uScores=Int(tLogined(18))
l_uNickname=tLogined(19)
l_uCommentCount=Int(tLogined(20))
l_uMessageCount=Int(tLogined(21))
If l_uNickname="" Then l_uNickname=l_uName
If InStr(tLogined(11), "$") Then
user_info = Split(tLogined(11), "$")
l_uFrame = user_info(1)
Else
l_uFrame = 1
End If
If true_domain = 1 Then
'判断用户绑定的顶级域名
l_ucustomdomain = tLogined(26)
If l_ucustomdomain <> "" Then
l_uDomain = l_ucustomdomain
End If
End If
l_uNewBie=Int(tLogined(22))
l_uIco=ProIco(tLogined(13), 1)
l_uLastLogin=tLogined(23)
l_ulogcount=Int(tLogined(24))
l_uvisitcount=Int(tLogined(25))
l_uAddtime=tLogined(11)
If IsNumeric(l_uGroupId) Then
'获得组信息
GetGroupInfo
'判断
Set rsLogin=Execute("Select top 1 groupid,g_points,g_autoupdate From oblog_groups Where g_level>" & l_Group(2,0) & " Order By g_level")
If Not rsLogin.Eof Then
If rsLogin("g_autoupdate")=1 Then
'判断是否需要升级
If l_uScores>=Int(rsLogin(1)) Then
Execute ("update oblog_groups set g_members=g_members-1 WHERE groupid = " &l_uGroupId)
Execute ("Update oblog_user Set user_group=" & rsLogin(0) & " Where userid=" & l_uid)
Execute ("update oblog_groups set g_members=g_members+1 WHERE groupid = " &rsLogin(0))
Call GetGroupInfo
'用户升级后需重新载入Session
Session ("CheckUserLogined") = ""
End If
End If
End If
End If
Set rsLogin = Nothing
End If
If Err Then
Err.Clear
Session ("CheckUserLogined") = ""
Logined = False
Response.Redirect (blogurl & "login.asp")
End if
CheckUserLogined = Logined
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询