Foxtable(狐表)用户栏目专家坐堂 → 移动开发登录


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

主题:移动开发登录

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


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
移动开发登录  发帖心情 Post By:2017/7/25 21:48:00 [只看该作者]

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 ".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中获取用户密码
If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
    If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then
        UserName = e.PostValues("username")
        Password = e.PostValues("password")
    End If
End If
Dim dr As DataRow
dr = DataTables("用户").SQLFind("[Name] = '" & UserName & "' And [是否可用] = 'true'")
If dr IsNot Nothing

If UserName = dr("name") AndAlso Password = dr("password") 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.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")  Then '判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 '如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            .AddInput("username","用户帐号","text")
            .AddInput("DWMC","所属单位","text")
            .AddInput("password","用户密码","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "submit")
        End With
    Case "exit.htm" '退出登录
        wb.DeleteCookie("username") '清除cookie中原来的用户名和密码
        wb.DeleteCookie("password")
        wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
    Case "", "default.htm" '首页
        wb.AddPageTitle("","pageheader","内江市教务系统","鹏宇科技设计")
        With wb.AddGrid("","g1")
            .Add("c1","增加订单", "./images/button.png").Attribute = ""
            .Add("c2","客户管理", "./images/cell.png", "http://www.foxtable.com")
            .Add("c3","销售统计", "./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","退出", "./images/exit.png", "exit.htm") '退出登录
        End With
End Select
e.WriteString(wb.Build)


老师,你好,开始学习移动设计,因用户帐号是用姓名做的, 但有可能重复,所以增加了个单位名称字段,在用户名中用的group列,现在想在输入用户帐号后,所属单位做个下拉列表来选择是单位名称GROUP,这该如何改,懂不起,初学请帮指导。

 回到顶部