Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
HttpRequest
Functions.Execute("one", e)
首版\one
Dim e As
RequestEventArgs = Args(0)
Select Case e.path
Case
"ad.htm"
Functions.Execute("ahome", e)
Case Else
Dim dr As DataRow = DataTables("控制台").SQLfind("path='" &
e.Path.Replace("'", "''").Replace("",
"''") & "'")
If dr IsNot Nothing Then
If dr("IsAsync") = True Then
e.AsyncExecute = True
Functions.AsyncExecute(dr("function"),
e)
Else
Functions.Execute(dr("function"), e)
End If
Else
Dim wb As New weui
wb.InsertHTML("<h3>页面丢失了!!</h3>")
wb.AppendHTML("<script>console.warn('" & e.Path
& "不在httpcase表,请检查是否没有设置.')</script>")
e.WriteString(wb.Build)
End If
End Select
Dim e As RequestEventArgs = Args(0)
''''''''第1到14行代码用于生成临时表和清除过期登录信息;
Static UserTable As DataTable '定义一个变量,用于存储用户随机身份ID,以及最后一次活动时间.
Static ClearTime As Date
If UserTable Is Nothing Then '创建用于记录登录信息的临时表
ClearTime = Date.Now()
Dim dtb As New DataTableBuilder("UserInfos")
dtb.AddDef("UserName", GetType(String), 16)
dtb.AddDef("UserID", GetType(String), 16)
dtb.AddDef("ActiveTime", GetType(Date))
UserTable = dtb.Build(True)
End If
If (Date.Now - ClearTime).TotalMinutes >= 30 Then '清除超过30分钟没有操作的登录信息
UserTable.DeleteFor("ActiveTime < #" & Date.Now.AddMinutes( - 30) & "#")
ClearTime = Date.Now()
End If
''''''''''第1到14行代码用于生成临时表和清除过期登录信息;
Dim wb As New weui
Dim UserName As String
Dim Password As String
Dim UserID As String
'第21到47行代码用于根据用户输入的用户名和密码进行身份验证,并在在临时表和Cookie中保存登录信息;
If e.Path = "logon.htm" Then'验证用户名和密码
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
Dim Verified As Boolean '用于标记用户是否通过了身份验证
UserName = e.PostValues("username")
Password = e.PostValues("password")
If UserName = "张三" AndAlso Password = "888" Then '实际使用的时候,请改为从数据库读取用户名和密码进行比较
Verified = True
ElseIf Username = "李四" AndAlso Password = "999" Then
Verified = True
End If
If Verified Then
UserID = Rand.NextString(16) '生成随机用户ID
UserName = EncryptText(UserName, "123", "123") '将用户名加密.
Dim dr As DataRow = UserTable.Find("UserName = '" & UserName & "'")
If dr IsNot Nothing Then '如果是重复登录,删除以前的登录信息
dr.Delete()
End If
dr = UserTable.AddNew()
dr("UserName") = UserName
dr("UserID") = UserId
dr("ActiveTime") = Date.Now '记录登录时间
wb.AppendCookie("username", UserName) '将用户名和UserID写入cookie
wb.AppendCookie("userid", UserID)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
e.WriteString(wb.Build) '生成网页
Return Nothing '必须的
End If
End If
Else '其它页面从Cookie提取登录信息进行验证
'第21到47行代码用于根据用户输入的用户名和密码进行身份验证,并在在临时表和Cookie中保存登录信息;
'第49到第58行代码用于从Cookie中提取登录信息进行身份验证,并更新最后一次活动时间;
UserName = e.Cookies("username") '从cookie中获取用户名
UserID = e.Cookies("userid") '从cookie中获取 随机ID
Dim dr As DataRow = UserTable.Find("UserName = '" & UserName & "'")
If dr IsNot Nothing AndAlso dr("UserID") = UserID Then '如果通过验证,更新活动时候,继续访问其它页面.
dr("ActiveTime") = Date.Now '更新活动时间
Else '如果验证失败
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb.Build) '生成网页
Return Nothing '必须的
End If
End If
'开始生成网页
'第49到第58行代码用于从Cookie中提取登录信息进行身份验证,并更新最后一次活动时间;
Select Case e.path
''''第63到第74行代码用于生成登录页面;
Case "logon.htm" '登录页面
'wb.AddPageTitle("", "pageheader", "正圆润智能管理系统", "由二八科技有限公司开发")
With wb.AddArticle("", "ar1")
.AddTitle("h1", "正圆润财务咨询服务有限公司")
.AddContent("法人在大中型企业从事会计工作二十五年,根据工作经验及总结,把会计的日常管理工作流程及解决方案编写成正圆润财务智能管理系统。宗旨:让事务变得简单。主要经营:代理记帐 纳税申报;软件设计 实施维护;提供财务解决方案;会计培训 包就业")
' .AddImage("./images/001.jpg")
End With
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("password", "密码", "password")
End With
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn1", "登录", "submit")
End With
'第63到第74行代码用于生成登录页面;
'''''第76到第78行代码用于退出登录;
Case "exit.htm" '退出登录
wb.DeleteCookie("username") '清除cookie中原来的用户名和UserID
wb.DeleteCookie("UserID")
wb.InsertHTML("<meta http-equiv='Refresh' c>") '然后直接跳转到登录页面
'''''第76到第78行代码用于退出登录;
'第80到第94行代码用于生成首页。
Case "", "default.htm" '首页
wb.AddPageTitle("", "pageheader", "正圆润智能管理系统", "由二八科技有限公司开发")
With wb.AddGrid("", "g1")
.Add("c1", "销售开单", "./images/button.png").Attribute = ""
.Add("c2", "采购入库", "./images/cell.png", "http://47.120.22.187:8080/AddNew.htm")
.Add("c3", "销售订单", "./images/toast.png", "http://www.foxtable.com")
.Add("c4", "采购订单", "./images/dialog.png", "http://www.foxtable.com")
.Add("c5", "生产报工", "./images/progress.png", "http://www.foxtable.com")
.Add("c6", "排产", "./images/msg.png", "http://www.foxtable.com")
.Add("c7", "应收管理", "./images/article.png", "http://www.foxtable.com")
.Add("c8", "应付管理", "./images/actionSheet.png", "http://www.foxtable.com")
.Add("c9", "现金银行", "./images/icons.png", "http://www.foxtable.com")
.Add("c10", "进销存", "./images/panel.png", "http://www.foxtable.com")
.Add("c11", "工资管理", "./images/tab.png", "http://www.foxtable.com")
.Add("c12", "工资管理", "./images/tab.png", "http://www.foxtable.com")
.Add("c13", "工资管理", "./images/tab.png", "http://www.foxtable.com")
.Add("c14", "工资管理", "./images/tab.png", "http://www.foxtable.com")
.Add("c15", "退出", "./images/exit.png", "exit.htm") '退出登录
End With
'第80到第94行代码用于生成首页。
End Select
e.WriteString(wb.Build) '生成网页