%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% ' *** Validate request to log in to this site. MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString MM_valUsername=CStr(Request.Form("UserID")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess="admin.asp" MM_redirectLoginFailed="Login.asp" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_hghg_STRING 'MM_rsUser.Source = "SELECT ID, Name" MM_rsUser.Source = "SELECT ID, Pwd, Name, Type , Ext, Mobile, Year(getdate()-UpdateTime) AS MyYear, month(getdate()-UpdateTime) AS MyMonth, day(getdate()-UpdateTime) AS MyDay, datepart(hh,(getdate()-UpdateTime)) AS MyHour, datepart(mi,(getdate()-UpdateTime)) AS MyMinute" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.hg_UserInfo WHERE ID='" & Replace(MM_valUsername,"'","''") &"' AND Name='" & Replace(Request.Form("PWD"),"'","''") & "'" MM_rsUser.CursorType = 0 MM_rsUser.CursorLocation = 2 MM_rsUser.LockType = 3 MM_rsUser.Open If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then ' username and password match - this is a valid user Session("MM_Username") = MM_valUsername If (MM_fldUserAuthorization <> "") Then Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else Session("MM_UserAuthorization") = "" End If if CStr(Request.QueryString("accessdenied")) <> "" And false Then MM_redirectLoginSuccess = Request.QueryString("accessdenied") End If Dim MyType MyType = MM_rsUser.Fields.Item("Type").Value Session("MyType") = MyType Session("MyUID") = Request("UserID") Session("MyName") = MM_rsUser.Fields.Item("Name").Value Dim IsRepeat IsRepeat = 0 If MM_rsUser.Fields.Item("MyYear").Value=1900 Then If MM_rsUser.Fields.Item("MyMonth").Value=1 Then If MM_rsUser.Fields.Item("MyDay").Value=1 Then If MM_rsUser.Fields.Item("MyHour").Value=0 Then If MM_rsUser.Fields.Item("MyMinute").Value<=2 Then IsRepeat=1 End If End If End If End If End If If IsRepeat=0 Then If MyType=0 Then Session("MyID") = Request("UserID") Session("MyExt")= MM_rsUser.Fields.Item("Ext").Value MM_redirectLoginSuccess = "superadmin.asp" End If If MyType=1 Then Session("MyType")= MM_rsUser.Fields.Item("type").Value MM_redirectLoginSuccess = "admin.asp" End If If MyType=2 Then ' Session("MyExt") = MM_rsUser.Fields.Item("Ext").Value 'Session("MyID") = Request("UserID") Session("MyType")= MM_rsUser.Fields.Item("type").Value MM_redirectLoginSuccess = "admin.asp" End If If MyType=3 Then MM_redirectLoginSuccess = "admin.asp" ' Session("MyExt")= MM_rsUser.Fields.Item("Ext").Value ' Session("MySeatNo") = Request("UserID") Session("MyType")= MM_rsUser.Fields.Item("type").Value End If MM_rsUser.Close Response.Redirect(MM_redirectLoginSuccess) Else MM_rsUser.Close Session("LoginFailed")=2 Response.Redirect(MM_redirectLoginFailed) End If End If MM_rsUser.Close Session("LoginFailed")=1 Response.Redirect(MM_redirectLoginFailed) end if %>