www.pudn.com > 图书管理系统包括VB,ASP各一份代码.rar > Login.dob


VERSION 5.00 
Begin VB.UserDocument Login  
   BackColor       =   &H00C0C0FF& 
   ClientHeight    =   9000 
   ClientLeft      =   0 
   ClientTop       =   0 
   ClientWidth     =   12000 
   HScrollSmallChange=   225 
   ScaleHeight     =   9000 
   ScaleWidth      =   12000 
   VScrollSmallChange=   225 
   Begin VB.Frame Frame1  
      BackColor       =   &H00E0E0E0& 
      BorderStyle     =   0  'None 
      Height          =   2295 
      Left            =   2880 
      TabIndex        =   4 
      Top             =   3360 
      Width           =   5280 
      Begin VB.TextBox txtUserName  
         Height          =   345 
         Left            =   2025 
         TabIndex        =   0 
         Top             =   480 
         Width           =   2325 
      End 
      Begin VB.CommandButton cmdOK  
         Caption         =   "登  录" 
         Default         =   -1  'True 
         Height          =   390 
         Left            =   2640 
         Style           =   1  'Graphical 
         TabIndex        =   2 
         Top             =   1680 
         Width           =   1140 
      End 
      Begin VB.TextBox txtPassword  
         Height          =   345 
         IMEMode         =   3  'DISABLE 
         Left            =   2025 
         PasswordChar    =   "*" 
         TabIndex        =   1 
         Top             =   870 
         Width           =   2325 
      End 
      Begin VB.Label lblLabels  
         BackStyle       =   0  'Transparent 
         Caption         =   "用户名(&U):" 
         Height          =   270 
         Index           =   0 
         Left            =   1080 
         TabIndex        =   6 
         Top             =   600 
         Width           =   1080 
      End 
      Begin VB.Label lblLabels  
         BackStyle       =   0  'Transparent 
         Caption         =   "口  令(&P):" 
         Height          =   270 
         Index           =   1 
         Left            =   1080 
         TabIndex        =   5 
         Top             =   960 
         Width           =   1080 
      End 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      BackColor       =   &H8000000E& 
      BackStyle       =   0  'Transparent 
      Caption         =   "图书管理系统" 
      BeginProperty Font  
         Name            =   "楷体_GB2312" 
         Size            =   26.25 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00FF0000& 
      Height          =   525 
      Left            =   3840 
      TabIndex        =   3 
      Top             =   1080 
      Width           =   3330 
   End 
End 
Attribute VB_Name = "Login" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = True 
Attribute VB_PredeclaredId = False 
Attribute VB_Exposed = True 
Option Explicit 
 
Private Sub cmdOK_Click() 
    Dim strUserName As String 
    Dim strPassword As String 
    Dim strTargetAsp As String 
    Dim conn As ADODB.Connection 
    Dim rsLogin As ADODB.Recordset 
    Dim strSQL As String 
     
    If Trim(txtUserName.Text) = "" Then 
        MsgBox "“用户名”不能为空!" 
        Exit Sub 
    Else 
        strUserName = Trim(txtUserName.Text) 
    End If 
    If Trim(txtPassword.Text) = "" Then 
        MsgBox "“口令”不能为空!" 
        Exit Sub 
    Else 
        strPassword = Trim(txtPassword.Text) 
    End If 
     
    '检查口令、用户身份 
    Set conn = New ADODB.Connection 
    conn.ConnectionString = pConn 
    conn.Open 
    strUserName = Replace(strUserName, "'", "''") 
    strSQL = "select * from 职员 where username='" & strUserName & "' and 口令='" & strPassword & "'" 
    Set rsLogin = conn.Execute(strSQL) 
    If rsLogin.EOF Or rsLogin.BOF Then 
        MsgBox "用户名或口令错误,请检查!" 
        txtPassword.SelStart = 0 
        txtPassword.SelLength = Len(txtPassword.Text) 
        txtPassword.SetFocus 
    Else 
        Select Case rsLogin("权限") 
            Case "院领导" 
                strTargetAsp = "LeadersMain.asp" 
            Case "主任" 
                strTargetAsp = "ZHURENMAIN.asp" 
            Case "秘书" 
                strTargetAsp = "MiShuMain.asp" 
            Case "图书管理员" 
                strTargetAsp = "TuShuManagerMain.asp" 
            Case Else 
                strTargetAsp = "OthersMain.asp" 
        End Select 
         
        SaveSetting "JGYOA", "Login", "UserName", strUserName 
         
        Hyperlink.NavigateTo "HTTP://" & pIP & "/oa/" & strTargetAsp 
         
    End If 
     
    '释放变量 
    Set rsLogin = Nothing 
    Set conn = Nothing 
End Sub