想实现操作单位自动填入usergroup的值 怎么纠正代码呢?
想实现信息时间自动填入date.today的值 怎么纠正代码呢?
代码如下:
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 "AddNew.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","信息编辑")
.AddInput("操作单位","操作单位","usergroup") '
.AddInput("信息时间","信息时间","Date") '