Foxtable(狐表)用户栏目专家坐堂 → 两种登录方式


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

主题:两种登录方式

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


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
两种登录方式  发帖心情 Post By:2020/6/17 22:12:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:新建文本文档.txt


改两个登录方式,不同提交按钮问题,谢谢

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


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/18 15:46:00 [显示全部帖子]

老师,请问改了哪里,没看出来

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/18 22:14:00 [显示全部帖子]

老师按上面做后点btn1提交时密码账正确但不跳转,按btn5提交帐号密码正确但还是刷新一下logon.htm就完了,整不走了

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/19 6:32:00 [显示全部帖子]

终于理清了,谢谢!

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/20 13:33:00 [显示全部帖子]

If  e.Path <> "zc.htm"  AndAlso e.path<> "czmm.htm" Then '身份验证
    If e.Path = "logon.htm"
        If e.Cookies("jsdnok")="yes" Or  e.Cookies("xsdnok")="yes"
            wb.InsertHTML("<meta http-equiv='Refresh' c>")' '直接跳转到首页
        Else
            If e.PostValues("btn1")="btn1"                 
                Dim cmd As new SQLCommand
                cmd.C
                cmd.CommandText ="Se\ect 身份证号,password from {用户} where 身份证号='" & e.PostValues("username") & "'"
                Dim dt As DataTable =  cmd.ExecuteReader
                Dim dr As DataRow = dt.find("身份证号='" & e.PostValues("usrername") & "' And [password]=  '" & e.PostValues("password")  &"'")
                If dr IsNot Nothing
                    wb.InsertHTML("<meta http-equiv='Refresh' c>")'
                    wb.AppendCookie("username",e.postvalues("username"))
                    wb.appendcookie("userjs","学生")
                    wb.appendcookie("xsdnok","yes")
                Else
                    wb.InsertHTML("<meta http-equiv='Refresh' c; url='logon.htm'>") '那么直接跳转到登录页面
                End If
                e.WriteString(wb.Build)
                Return '
            End If
            If e.PostValues("btn5")="btn5"
                Dim cmd1 As new SQLCommand
                cmd1.C
                cmd1.CommandText ="Se\ect DISTINCT 单位,部门,角色,密码  from {单位用户} "
                Dim dt1 As DataTable =  cmd1.ExecuteReader
                Dim dr As DataRow = dt1.find("单位='" & e.PostValues("单位") & "' And 部门= '" & e.PostValues("部门")  & "' And 密码=  '" & e.PostValues("密码")  &"'")
                If dr IsNot Nothing
                    wb.InsertHTML("<meta http-equiv='Refresh' c>")'
                    wb.AppendCookie("userdw",dr("单位"))
                    wb.AppendCookie("userbm",dr("部门"))
                    wb.appendcookie("userjs",dr("角色"))
                    wb.appendcookie("jsdnok","yes")
                Else
                    wb.InsertHTML("<meta http-equiv='Refresh' c; url='logon.htm'>") '那么直接跳转到登录页面
                End If
                e.WriteString(wb.Build)
                Return '
            End If
        End If
    End If
End If


老师,请问我为了理清这个关系这样改了,但不能跳转

[此贴子已经被作者于2020/6/20 13:33:10编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/20 21:10:00 [显示全部帖子]

If  e.Path <> "zc.htm"  AndAlso e.path<> "czmm.htm" Then '身份验证
    If e.Path = "logon.htm"
        If e.Cookies("dnok")="js" Or  e.Cookies("dnok")="xs"
            wb.InsertHTML("<meta http-equiv='Refresh' c>")' '直接跳转到首页
            e.WriteString(wb.Build)
            Return '
        Else
            If e.PostValues("btn1")="btn1"
                Dim cmd As new SQLCommand
                cmd.C
                cmd.CommandText = "SE/ECT 身份证号,password,_identify FROM {用户} WHERE 身份证号 = '" & e.PostValues("username") & "' and password ='" & e.PostValues("password") & "'"
                Dim dt As DataTable = cmd.ExecuteReader
                If dt.DataRows.count>0
                    wb.InsertHTML("<meta http-equiv='Refresh' c>")'
                    wb.AppendCookie("username",e.postvalues("username"))
                    wb.appendcookie("userjs","学生")
                    wb.appendcookie("dnok","xs")
                Else
                    wb.AddTopTips("","toptip1","用户名或密码错误或已停用!").msec = 3000
                    wb.InsertHTML("<meta http-equiv='Refresh' c; url='logon.htm'>") '那么直接跳转到登录页面
                End If
                e.WriteString(wb.Build)
                Return '
            End If
            If e.PostValues("btn5")="btn5"
                Dim cmd1 As new SQLCommand
                cmd1.C
                cmd1.CommandText ="Se/ect DISTINCT 单位,部门,角色,密码  from {单位用户} "
                Dim dt1 As DataTable =  cmd1.ExecuteReader
                Dim dr As DataRow = dt1.find("单位='" & e.PostValues("单位") & "' And 部门= '" & e.PostValues("部门")  & "' And 密码=  '" & e.PostValues("密码")  &"'")
                If dr IsNot Nothing
                    wb.InsertHTML("<meta http-equiv='Refresh' c>")'
                    wb.AppendCookie("userdw",dr("单位"))
                    wb.AppendCookie("userbm",dr("部门"))
                    wb.appendcookie("userjs",dr("角色"))
                    wb.appendcookie("dnok","js")
                Else
                    wb.InsertHTML("<meta http-equiv='Refresh' c; url='logon.htm'>") '那么直接跳转到登录页面
                End If
                e.WriteString(wb.Build)
                Return '
            End If
        End If        
    End If
End If
'

老师,请调试行了,还有些问题
1、红色的部分想增加个密码错误提示,不能显示出来呢,
2、如何用代码控制page2处于当前显示,缺省的是page1处于当前显示
With wb.AddTabBar("", "tb1", 1)
    .AddPage("page1","学生家长登录","../tubiao/xsdn.png")
    .AddPage("page2","学校班级登录","../tubiao/jsdn.png")
End With


[此贴子已经被作者于2020/6/21 13:15:20编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/22 15:42:00 [显示全部帖子]

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
wb.Inserthtml("<style>.weui_tabbar_label{font-size:16px}</style>")
wb.Inserthtml("<style>.weui_tabbar_icon{whidth:20px;height:20px;}</style>")
wb.Inserthtml("<style>p{margin:10px 16px;}</style>")
wb.AddPageTitle("","pageheader","教务","")
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then
    wb.AddTopTips("","toptip1","用户名或密码错误或已停用!").msec = 3000
End If
With wb.AddTabBar("", "tb1", 1)
    .AddPage("page1","学生家长登录","../tubiao/xsdn.png")
    .AddPage("page2","学校班级登录","../tubiao/jsdn.png")
End With
If e.Cookies("dnok")="js"
wb.AppendHTML("<script>hide('page1');show('page2')</script>") 
End If
wb.AddForm("page1","form1","logon.htm")
Dim cmd1 As new SQLCommand
cmd1.C
cmd1.CommandText ="Se/ect DISTINCT 单位,部门,密码  from {单位用户} "
Dim dt1 As DataTable =  cmd1.ExecuteReader
Dim xxs As List(of String)=dt1.GetValues("单位")
With wb.AddInputGroup("form1","ipg1")
    Dim In1= .AddInput("username","学生证件:","text")
    In1.placeholder ="学生本人准确身份证号"
    In1.value=e.Cookies("username")
    .AddInput("password","登录密码:","password")
End With
With wb.AddButtonGroup("form1","btg1",False)
    Dim btn1=.Add("btn1", "登录", "submit")
    btn1.kind=1
    btn1.value="btn1"
    .Add("btn2", "注册", "", "zc.htm").kind=1
    .Add("btn3", "APP安装","","http://njsjwxt.com:8888/jwxt.apk").kind=1
    .Add("btn4", "忘记密码","","czmm.htm").kind=1
End With
wb.AddForm("page2","form2","logon.htm")
With wb.AddInputGroup("form2","ipg2","")
    .AddSelect("单位","单位名称:"," |" &  String.join("|",xxs.Toarray)).attribute=""
    .Addselect("部门","所属部门:","")
    .AddInput("密码","登录密码:","password")
End With
With wb.AddButtonGroup("form2","btg2",False)
    Dim btn5 = .Add("btn5", "登录", "submit")
    btn5.kind=1
    btn5.value="btn5"
    '.Add("btn2", "注册", "", "zc.htm").kind=1
    .Add("btn6", "APP安装","","http://njsjwxt.com:8888/jwxt.apk").kind=1
    .Add("btn7", "忘记密码","","czmm.htm").kind=1
End With

For Each xx As String In xxs
    wb.InsertHTML("<p hidden id='" & xx & "'>" & " |" & dt1.GetComboListString("部门","单位='" & xx & "'") & "</p>")
Next
wb.AppendHTML("<script src=./lib/getbj.js></script>")
e.WriteString(wb.Build)
e.Handled =True


老师,是这样写了还是不行,当输入密码不正确时没有任何反应就刷新了logon.htm,我没理解到我是在输入帐号或密码有错提示错误,请问我想改为showDialog试给用户个提示怎么写

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/22 16:47:00 [显示全部帖子]

If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") OrElse e.PostValues.ContainsKey("单位") AndAlso e.PostValues.ContainsKey("部门") AndAlso e.PostValues.ContainsKey("密码")  Then
    wb.AddTopTips("","toptip1","用户名或密码错误或已停用!").msec = 3000
End If
With wb.AddTabBar("", "tb1", 1)
    .AddPage("page1","学生家长登录","../tubiao/xsdn.png")
    .AddPage("page2","学校班级登录","../tubiao/jsdn.png")
End With
If e.Cookies("dnok")="js"
wb.AppendHTML("<script>hide('page1');show('page2')</script>") 
End If
wb.AddForm("page1","form1","logon.htm")

老师,不好意思,确定理解不到,因为没代码的对输入的帐号密码做判断,为什么就用这个就可以进行错误提示,现在改成这样还是没得提示得

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/22 18:22:00 [显示全部帖子]

我是要在输入帐号密码后如果错了给个提示

 回到顶部
帅哥哟,离线,有人找我吗?
刘林
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1942 积分:14919 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2020/6/22 21:12:00 [显示全部帖子]



请老师帮看下,现在的想法就是当帐号不存在提示该用户不存在,当密码错误提示密码错误,如果能用Dialog方式就最好,谢谢
[此贴子已经被作者于2020/6/22 22:09:30编辑过]

 回到顶部
总数 13 1 2 下一页