📄 frmtestpwd.frm
字号:
VERSION 5.00
Begin VB.Form frmTestPWD
BorderStyle = 1 'Fixed Single
ClientHeight = 2520
ClientLeft = 1560
ClientTop = 1845
ClientWidth = 5565
Icon = "frmTestPWD.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2520
ScaleWidth = 5565
Begin VB.TextBox txtPassword
Height = 315
IMEMode = 3 'DISABLE
Index = 1
Left = 180
MaxLength = 250
PasswordChar = "*"
TabIndex = 1
Top = 1740
Width = 4095
End
Begin VB.CommandButton cmdChoice
Caption = "&OK"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 4500
TabIndex = 2
Top = 1260
Width = 975
End
Begin VB.CommandButton cmdChoice
Caption = "&Cancel"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 4500
TabIndex = 3
Top = 1710
Width = 975
End
Begin VB.TextBox txtPassword
Height = 315
IMEMode = 3 'DISABLE
Index = 0
Left = 840
MaxLength = 15
TabIndex = 0
Top = 1035
Width = 3435
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Password / Passphrase"
Height = 195
Index = 1
Left = 180
TabIndex = 7
Top = 1500
Width = 1680
End
Begin VB.Label lblMyLabel
BackStyle = 0 'Transparent
Height = 240
Left = 240
TabIndex = 6
Top = 2220
Width = 3405
End
Begin VB.Label lblTitle
Alignment = 2 'Center
BackColor = &H00C00000&
BorderStyle = 1 'Fixed Single
Caption = "Test Pasword Entry"
BeginProperty Font
Name = "Times New Roman"
Size = 26.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 735
Left = 120
TabIndex = 5
Top = 120
Width = 5310
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "User ID"
Height = 195
Index = 0
Left = 170
TabIndex = 4
Top = 1140
Width = 540
End
End
Attribute VB_Name = "frmTestPWD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' ===========================================================================
' DATE NAME DESCRIPTION
' ----------- ------------------------ ------------------------------------
' 30-DEC-2000 Kenneth Ives Written by kenaso@home.com
' ---------------------------------------------------------------------------
' Define module level variables
' ---------------------------------------------------------------------------
Private arUserID() As Byte
Private arPWord() As Byte
Private m_strUserID As String
Private m_strPWord As String
Private Sub cmdChoice_Click(Index As Integer)
' ---------------------------------------------------------------------------
' Define variables
' ---------------------------------------------------------------------------
Dim strTmp1 As String
Dim strTmp2 As String
' ---------------------------------------------------------------------------
' Based on the button pressed
' ---------------------------------------------------------------------------
Select Case Index
' OK button was pressed.
Case 0:
' Test length of user ID
If Len(m_strUserID) = 0 Then
MsgBox "A user ID must be entered.", _
vbInformation Or vbOKOnly, "User ID missing"
txtPassword(0).SetFocus
Exit Sub
Else
arUserID = ConvertToArray(m_strUserID)
End If
' Test length of password
If Len(m_strPWord) = 0 Then
MsgBox "A password / passphrase must be entered.", _
vbInformation Or vbOKOnly, "Password / Passphrase missing"
Erase arPWord()
m_strPWord = ""
txtPassword(1).SetFocus
Exit Sub
Else
arPWord = ConvertToArray(m_strPWord)
End If
' Test length of password data entered
If Not Correct_Password_Length(arPWord()) Then
Erase arPWord()
m_strPWord = ""
txtPassword(1).Text = ""
txtPassword(1).SetFocus
Exit Sub
End If
' Is this user on file?
If Not Query_User(arUserID(), strTmp1, strTmp2) Then
MsgBox "User [ " & m_strUserID & _
" ] cannot be found in the database.", _
vbInformation Or vbOKOnly, "Invalid User ID"
' get rid of any data returned
strTmp1 = String$(250, 0)
strTmp2 = String$(250, 0)
Reset_frmTestPWD
Exit Sub
Else
' get rid of any data returned
strTmp1 = String$(250, 0)
strTmp2 = String$(250, 0)
End If
' Compare with the data entered with the hashed results
' in the database.
If Not Validate_Password(arUserID(), arPWord()) Then
Erase arPWord()
m_strPWord = ""
txtPassword(1).Text = ""
txtPassword(1).SetFocus
Exit Sub
End If
' We were successful
MsgBox "Successfully identified user [ " & _
m_strUserID & " ] in the database.", _
vbInformation Or vbOKOnly, "Success"
Reset_frmTestPWD
' Cancel button was pressed.
Case 1:
' Return to the main menu.
Reset_frmTestPWD
frmTestPWD.Hide
frmMainMenu.Show
End Select
End Sub
Private Sub ClearVariables()
' ---------------------------------------------------------------------------
' clear variables
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -