Foxtable(狐表)用户栏目专家坐堂 → username password usergroup 三个字段值全部符合才能进入登录,但是当前却无任何提示 求解!


  共有2312人关注过本帖树形打印复制链接

主题:username password usergroup 三个字段值全部符合才能进入登录,但是当前却无任何提示 求解!

帅哥哟,离线,有人找我吗?
李孝春
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2472 积分:17346 威望:0 精华:0 注册:2013/1/31 0:03:00
username password usergroup 三个字段值全部符合才能进入登录,但是当前却无任何提示 求解!  发帖心情 Post By:2019/5/28 16:09:00 [显示全部帖子]

运行报错
.NET Framework 版本:2.0.50727.8941
Foxtable 版本:2018.10.9.1
错误所在事件:项目,HttpRequest
详细错误信息:
未将对象引用设置到对象的实例。


代码如下:



Dim fl As String = "d:\web\" & e.path
If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String  = fl.SubString(idx)
    Select Case ext
        Case ".ico",".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.WriteFile(fl)
            Return '这里必须返回
    End Select
End If

Dim wb As New weui
'身份验证
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserName As String = e.Cookies("username") '从cookie中获取用户名
Dim Password As String = e.Cookies("password") '从cookie中获取用户密码
Dim usergroup As String = e.Cookies("usergroup")
If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
    If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  AndAlso e.PostValues.ContainsKey("usergroup")  Then
        usergroup = e.PostValues("usergroup")
        UserName = e.PostValues("username")
        Password = e.PostValues("password")
    End If
End If

If UserName <>"" AndAlso Password <>"" AndAlso usergroup <>"" Then
    Dim dr11 As DataRow
    dr11 = DataTables("systemuser").SQLFind("username = '" & username & "'and usergroup = '" & usergroup & "'")
    If UserName = dr11("username") AndAlso Password = dr11("Password") AndAlso usergroup = dr11("usergroup") Then
        Verified  = True
    End If
End If


If Verified AndAlso e.Path = "logon.htm"  Then '如果用户访问的是登录页,且身份验证成功
    wb.AppendCookie("username",UserName) '将用户名和密码写入cookie
    wb.AppendCookie("password",Password)
    wb.AppendCookie("usergroup",usergroup)
    wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
    e.WriteString(wb.Build) '生成网页
    Return '必须的
ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then '如果用户身份验证失败,且访问的不是登录页面
    wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
    e.WriteString(wb.Build) '生成网页
    Return '必须的
End If

Select Case e.Path
    Case "logon.htm" '登录页面
        
        wb.AddPageTitle("","pageheader","","")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") AndAlso e.PostValues.ContainsKey("usergroup")   Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            Dim filter11 As String = "表名 = '干警信息' and 列名 = '所在单位' and 停用 = false"
            Dim fdr11 As DataRow = DataTables("列项设置").Find(filter11)
            If fdr11 IsNot Nothing Then
                Dim abc11 As String=fdr11("下拉选项").replace(",", "|")
                .AddSelect("usergroup","所在单位","|"&abc11)
            End If
            .AddInput("username","户名","text")
            .AddInput("password","密码","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "submit")
        End With
        With wb.AddPageFooter("","pf1","Copyright &copy; ")
            '.AddLink("底部链接","http://www.foxtable.com")
        End With
        e.WriteString(wb.Build)
        
    Case "exit.htm" '退出登录
        wb.DeleteCookie("username") '清除cookie中原来的用户名和密码
        wb.DeleteCookie("password")
        wb.DeleteCookie("usergroup")
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
        
    Case "", "default.htm" '首页
        wb.AddPageTitle("","pageheader","","")
        With wb.AddGrid("","g1")
            .Add("c1","增加干警信息", "./images/TableProperty.ico", "addnewtxl.htm")
            .Add("c2","增加管理人员", "./images/TableProperty.ico", "adduser.htm")
            .Add("c3","查询干警信息", "./images/TableProperty.ico", "filter.htm")
            .Add("c4","增加发布信息", "./images/TableProperty.ico", "AddNew.htm") '.Attribute = ""
            .Add("c5","拟新增", "./images/TableProperty.ico", " ")
            .Add("c6","拟新增", "./images/TableProperty.ico", " ")
            .Add("c7","拟新增", "./images/TableProperty.ico", "")
            .Add("c8","拟新增", "./images/TableProperty.ico", "")
            .Add("c9","拟新增", "./images/TableProperty.ico", "")
            .Add("c10","拟新增", "./images/TableProperty.ico", "")
            .Add("c11","拟新增", "./images/TableProperty.ico", "")
            .Add("c12","退出", "./images/exit.ico", "exit.htm") '退出登录
        End With
        With wb.AddPageFooter("","pf1","Copyright &copy; ")
            '.AddLink("底部链接","http://www.foxtable.com")
        End With
        e.WriteString(wb.Build)

End Select
e.WriteString(wb.Build) '生成网页
[此贴子已经被作者于2019/5/28 16:19:20编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
李孝春
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2472 积分:17346 威望:0 精华:0 注册:2013/1/31 0:03:00
回复:(有点甜)查找之后判断一下是否找到 ...  发帖心情 Post By:2019/5/30 12:43:00 [显示全部帖子]

OK  谢谢!

 回到顶部