以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 退出登录exit.htm,页面报错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=178873) |
-- 作者:一笑 -- 发布时间:2022/7/25 13:51:00 -- 退出登录exit.htm,页面报错 按照移动开发编写: Case "exit.htm" \'退出登录 wb.DeleteCookie("username") \'清除cookie中原来的用户名和UserID wb.DeleteCookie("UserID") wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'然后直接跳转到登录页面 但是未跳转到登录页面,页面显示以下信息:
foxtable web server has started(error 404). 求解,谢谢! |
-- 作者:有点蓝 -- 发布时间:2022/7/25 14:26:00 -- 给的代码不完整 |
-- 作者:一笑 -- 发布时间:2022/7/25 15:19:00 -- Dim wb As New weui \'身份验证 Dim UserName As String Dim Password As String Dim UserID As String Dim UserGroup As String If e.Path = "logon.htm" \'验证用户名和密码 If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then Dim Verified As Boolean \'用于标记用户是否通过了身份验证 UserName = e.PostValues("username") Password = e.PostValues("password") Dim fdr As DataRow fdr = DataTables("Usersun").SQLFind("[Name] = \'" & UserName & "\'") If fdr IsNot Nothing Then If fdr("Password") = Password Then Verified = True End If End If If Verified Then UserID = Rand.NextString(16) \'生成随机用户ID UserName = EncryptText(UserName,"123","123") \'将用户名加密. Dim dr As DataRow = UserTable.Find("UserName = \'" & UserName & "\'") If dr IsNot Nothing Then \'如果是重复登录,删除以前的登录信息 dr.Delete() End If dr = UserTable.AddNew() dr("UserName") = UserName dr("UserID") = UserId dr("ActiveTime") = Date.Now \'记录登录时间 wb.AppendCookie("username",UserName) \'将用户名和密码写入cookie wb.AppendCookie("userid",UserID) wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'直接跳转到首页 e.WriteString(wb.Build) \'生成网页 Return \'必须的 End If End If Else \'其它页面从Cookie提取登录信息进行验证 UserName = e.Cookies("username") \'从cookie中获取用户名 UserID = e.Cookies("userid") \'从cookie中获取 随机ID Dim dr As DataRow = UserTable.Find("UserName = \'" & UserName & "\'") If dr IsNot Nothing AndAlso dr("UserID") = UserID Then \'如果通过验证,更新活动时候,继续访问其它页面. dr("ActiveTime") = Date.Now \'更新活动时间 Else \'如果验证失败 wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'那么直接跳转到登录页面 e.WriteString(wb.Build) \'生成网页 Return \'必须的 End If End If Case "logon.htm" \'登录页面 wb.AddPageTitle("","pageheader","安全信息管理平台","日照机场") If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then \'判断是否是验证失败后的重新登录 wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If wb.AddForm("","form1","logon.htm") With wb.AddInputGroup("form1","ipg1") .AddInput("username","户名","text") .AddInput("password","密码","password") End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "登录", "submit").Attribute = "style=\'background-color:Turquoise;width:300px;\'" End With e.WriteString(wb.Build) \'生成网页 Case "exit.htm" \'退出登录 wb.DeleteCookie("username") \'清除cookie中原来的用户名和密码 wb.DeleteCookie("password") wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'然后直接跳转到登录页面 |
-- 作者:有点蓝 -- 发布时间:2022/7/25 15:28:00 -- 代码不完整。有些代码被论坛屏蔽了,参考这里的方法发:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=69632 wb.InsertHTML("<meta http-equiv=\'Refresh\' c>") \'然后直接跳转到登录页面
|