| Structure FixUse '用户表 Public ID As Integer '用户ID <VBFixedArray(15)> Public NoCard() As Byte '卡号 <VBFixedArray(15)> Public NoUser() As Byte '学号 <VBFixedArray(15)> Public Name() As Byte '姓名 <VBFixedArray(15)> Public PSW() As Byte '密码 Public Dept As Integer '部门ID Public Attr As Integer '机房总管 Public AttreEx As Integer '机房总管扩展 Public Money As Integer '帐户金额 Public Power As Integer '用户权限 Public PowerEx As Integer '用户权限扩展 Public MoneyEx As Integer '帐户金额扩展 <VBFixedArray(31)> Public Rev() As Byte '系统, End Structure Structure FixLog '上下机、交费日志表 Dim ID As Integer '流水号 Dim Type As Integer '事件类型 <VBFixedArray(5)> Dim DateTime() As Byte '上机开始时间,若为交费,则为空 <VBFixedArray(5)> Dim MAC() As Byte '指定上机IP地址 Dim ManagerID As Integer '收费管理员ID Dim UserID As Integer '用户ID Dim Money As Integer '消费或交费金额 Dim ID_EquipMent As Integer '上机设备号 <VBFixedArray(5)> Dim DateTimeEnd() As Byte '下机时间 Public Location As Int64 '系统保留 <VBFixedArray(13)> Dim revex() As Byte '保留 End Structure |

|
| <forms name="cookie-name" path="/" loginUrl="/webchongyuan/login.aspx" protection="Encryption" timeout="10" /> </authentication> |
| LoginType = UseServer.LoginIn(txtName.Text.Trim, txtPass.Text.Trim) '获得权限级别 Session("LoginType") = LoginType '将权限级别存储在会话中 Select Case LoginType Case DataType.Data.LoginType.SUPUERMANAGER '高级管理员 FormsAuthentication.RedirectFromLoginPage(txtName.Text, False) clsDebug.DebugFileOut(txtName.Text & vbTab & Now.ToString) Response.Redirect("entertime.aspx") '转向后续页面 Case DataType.Data.LoginType.NORMALMANAGER, DataType.Data.LoginType.NORMALUSER '辅助管理员或一般用户,在后续页面中通过Session来区别权限 FormsAuthentication.RedirectFromLoginPage(txtName.Text, False) clsDebug.DebugFileOut(txtName.Text & vbTab & Now.ToString) Response.Redirect("entertime.aspx") Case DataType.Data.LoginType.NOUSER '用户不存在 txtName.Text = "" lblMsg.Text = "用户名不存在" End Select |
| Private Sub RemovedCallBackLog(ByVal key As String, ByVal Value As Object, ByVal Reason As CacheItemRemovedReason) '当缓存超时,自动调用该函数 BuildLogCache() End Sub Private Sub BuildLogCache() '重建日志缓存,重新读取磁盘数据到内存 Dim UseServer As clsUseServer '用户服务对象,处理用户数据的各种需求 Dim LogServer As clsLogServer '日志服务对象,处理日志数据的各种需求 Dim strUseMsg As String '给用户显示的信息 Dim CacheTime As String '日志在内存中缓存的时间 Dim onRemove As New CacheItemRemovedCallback(AddressOf Me.RemovedCallBackLog) '回调 Try If IsNothing(Cache("UseServer")) Then BuildUseCache()'若用户缓存为空,则重建用户缓存(日志服务对象中要使用用户服务对象) UseServer = CType(Cache("UseServer"), clsUseServer) '将用户服务对象缓存 clsLogFunction.LogHebin() '在管理员登录时,合并日志文件 LogServer = New clsLogServer(UseServer) '从用户服务对象新建日志服务对象 CacheTime = ConfigurationSettings.AppSettings("LogCacheTime") '从Web.config中获得缓存日志对象的时间 Cache.Insert("LogServer", LogServer, Nothing,DateTime.Now.AddMinutes(CInt(CacheTime)), TimeSpan.Zero, CacheItemPriority.Normal, onRemove) '将日志服务对象缓存 Catch ex As Exception clsDebug.DebugFileOut(ex.Message) '记录异常信息 End Try End Sub |