以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  网页设计cookie问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=160956)

--  作者:ycs5801
--  发布时间:2021/2/27 15:08:00
--  网页设计cookie问题
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim dr As DataRow=DataTables("报关员").sqlfind("手机号=\'" & e.Cookies("username")  & "\'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  \'\'\'如果有此用户,且密码正确.    
   
    With wb.AddGrid("","g1")
        .Add("c1","Button", "./images/button.png").Attribute = ""
        .Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com")
        .Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com")
        .Add("c4","Dialog", "./images/dialog.png", "http://www.foxtable.com")
        .Add("c5","Progress", "./images/progress.png", "http://www.foxtable.com")
        .Add("c6","Msg", "./images/msg.png", "http://www.foxtable.com")
        .Add("c7","Article", "./images/article.png", "http://www.foxtable.com")
        .Add("c8","ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com")
        .Add("c9","Icons", "./images/icons.png", "http://www.foxtable.com")
        .Add("c10","Panel", "./images/panel.png", "http://www.foxtable.com")
        .Add("c11","Tab", "./images/tab.png", "http://www.foxtable.com")
        .Add("c12","SearchBar", "./images/search.png", "http://www.foxtable.com")
    End With
e.WriteString(wb.Build)
Else
    wb.AppendHTML("<meta http-equiv=\'Refresh\' c>")
End If


Dim dr As DataRow=DataTables("报关员").sqlfind("手机号=\'" & e.Cookies("username")  & "\'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  \'\'\'如果有此用户,且密码正确.    

这句代码是否正确?现在我无法提取到cookie值,直接就转到login页面了。

--  作者:有点蓝
--  发布时间:2021/2/27 17:01:00
--  
登录的时候是怎么保存cookie的?
--  作者:ycs5801
--  发布时间:2021/2/27 17:58:00
--  这样
 Dim dr As DataRow=DataTables("报关员").sqlfind("手机号=\'" & e.postvalues("手机号") & "\'")
    If dr IsNot Nothing Then  \'\'\'如果有此用户,那么继续判断.
        If dr("密码")=e.postvalues("密码") Then \'\'\'判断密码是否正确
wb.AppendCookie("username",e.postvalues("手机号"), 43200)
wb.AppendCookie("password",e.postvalues("密码") ,43200)


--  作者:有点蓝
--  发布时间:2021/2/28 20:07:00
--  
贴出3楼代码所在事件的完整代码看看。

自己调试一下

Dim dr As DataRow=DataTables("报关员").sqlfind("手机号=\'" & e.postvalues("手机号") & "\'")
    If dr IsNot Nothing Then  \'\'\'如果有此用户,那么继续判断.
        If dr("密码")=e.postvalues("密码") Then \'\'\'判断密码是否正确
msgbox(e.postvalues("手机号"))
msgbox(e.postvalues("密码"))
wb.AppendCookie("username",e.postvalues("手机号"), 43200)
wb.AppendCookie("password",e.postvalues("密码") ,43200)

------------

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
msgbox(e.Cookies("username"))
msgbox(e.Cookies("password"))
Dim dr As DataRow=DataTables("报关员").sqlfind("手机号=\'" & e.Cookies("username")  & "\'")

If dr IsNot Nothing  AndAlso  dr("密码")=e.Cookies("password")  Then  \'\'\'如果有此用户,且密码正确.