zdzs函数:
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
msgbox(e.Request.Headers("User-Agent"))
If e.Request.Headers("User-Agent").ToLower.Contains("micromessenger") Then
Dim openid As String
Dim dropenid As DataRow
openid = Functions.Execute("getopenid", e) '提取用户openid
msgbox("openid=" & openid)
If openid <> "" Then '假如提取到openid
' messagebox.Show("1")
dropenid = DataTables("登录用户").sqlfind("openid='" & openid & "'") '在登录用户表中查找此openid
End If
' messagebox.Show("2")
msgbox("dropenid=" & (dropenid IsNot Nothing))
If dropenid IsNot Nothing Then '如果找到了用户的openid
' messagebox.Show("3")
wb.AppendCookie("用户姓名", dropenid("用户姓名")) '将用户名信息写入cookie
wb.AppendCookie("用户密码", dropenid("用户密码"))
wb.AppendCookie("用户类别", dropenid("用户类别"))
wb.AppendCookie("用户单位", dropenid("用户单位"))
wb.AppendCookie("用户账号", dropenid("用户账号"))
wb.AppendCookie("用户级别", dropenid("用户级别"))
wb.AppendCookie("手机号", dropenid("手机号"))
wb.AppendCookie("邮箱地址", dropenid("邮箱地址"))
End If
ElseIf e.Cookies.ContainsKey("用户姓名") And e.Cookies.ContainsKey("用户密码") Then
msgbox("用户姓名")
Dim dr As DataRow = DataTables("登录用户").sqlfind("用户姓名='" & e.Cookies("用户姓名") & "'")
If dr Is Nothing OrElse dr("用户密码") <> e.Cookies("用户密码") Then '''如果无此用户,或密码不正确.
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
Else
msgbox("logon.htm")
wb.InsertHTML("<meta http-equiv='Refresh' c>")
e.WriteString(wb.Build)
Return""
End If
msgbox("name=" & e.GetValues.ContainsKey("name") )