Dim e As RequestEventArgs = Args(0)
Dim wb As New weui
Select Case e.Path
Case "test1.htm"
Dim Verified As Boolean '用于标记用户是否通过了身份验证
wb.AddToast("", "t1", "正在上传", 1) '定义提示
If e.PostValues.Count = 0 Then
wb.AddForm("", "form1", "test1.htm")
With wb.AddInputGroup("form1", "ipg1", "登录")
.AddInput("户名", "户名", "Text")
.AddInput("密码", "密码", "Text")
End With
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn1", "确定", "submit")
End With
e.WriteString(wb.Build)
Else
Dim nms() As String = {"户名", "密码"} '重新定义了nms数组,增加了两列.
Dim dr1 As DataRow
dr1 = DataTables("用户").SQLFind("姓名 = '" & nms(0) & "' And 密码 = '" & nms(1) & "'")
If dr1 IsNot Nothing Then '判断此用户不存在
Verified = False
Else
Verified = True
End If
If Verified AndAlso e.Path = "test1.htm" Then '如果用户访问的是登录页,且身份验证成功
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
e.WriteString(wb.Build) '生成网页
Return Nothing '必须的
ElseIf Verified = False AndAlso e.Path <> "test1.htm" Then '如果用户身份验证失败,且访问的不是登录页面
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb.Build) '生成网页
Return Nothing'必须的
End If
End If
End Select
登户判别录入的用户名与密码是否与用户名一致
Dim nms() As String = {"户名", "密码"} '重新定义了nms数组,增加了两列.
Dim dr1 As DataRow
dr1 = DataTables("用户").SQLFind("姓名 = '" & nms(0) & "' And 密码 = '" & nms(1) & "'")
If dr1 IsNot Nothing Then '判断此用户不存在
Verified = False
Else
Verified = True
End If
这个只有 Verified = False才能正常,应该是
dr1 = DataTables("用户").SQLFind("姓名 = '" & nms(0) & "' And 密码 = '" & nms(1) & "'")
出错了
http://www.foxtable.com/mobilehelp/topics/0113.htm
msgbox(nms(0))
msgbox(e.PostValues(nms(0)))
dr1 = DataTables("用户").SQLFind("姓名 = '" & e.PostValues(nms(0)) & "' And