Discuz! Passport 通行证整合(6)

function login()
        dim auth,forward,verify,member_info
        '需根据实际情况修改,这里只作最简单的验证
        if request.Form("username")="admin" and request.Form("password")="123456" then
                '设置自己的cookie 或 session
                response.Cookies("username")=request.Form("username")

                '========================================================
                '===============passport 整合开始========================
                '========================================================
                '假设从用户数据库里取出email 为abc@hotmail.com
                member_info="time="  & datediff("s","1970-1-1 00:00:00",now) &_
                                                        "&username=" & request.Form("username") &_
                                                        "&password=" & md5(request.Form("password"),32) &_
                                                        "&email="    & "abc@hotmail.com
                auth = passport_encrypt(member_info , PassportKey)               
                response.Cookies("auth")=auth
                forward=request.form("forward")
                if forward="" then forward=YourAspWeb_Url       
                verify = md5("login" & auth & forward & PassportKey,32)
                auth=server.URLEncode(auth)
                forward=server.URLEncode(forward)       
                response.Redirect(DiscuzBbs_Url & "api/passport.php?action=login&auth=" & auth & "&forward=" & forward & "&verify=" & verify)                       
                '========================================================
                '===============passport 整合结束========================
                '========================================================

        else
                        response.Write("登陆失败<br>")
        end if
end function

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/a6b433df30aff4795dbf0d07a5abf20e.html