📄 formforget.frm
字号:
VERSION 5.00
Begin VB.Form FormForget
Caption = "忘记密码"
ClientHeight = 3960
ClientLeft = 60
ClientTop = 450
ClientWidth = 6630
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3960
ScaleWidth = 6630
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer3
Enabled = 0 'False
Interval = 1000
Left = 3240
Top = 2880
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 1000
Left = 6120
Top = 120
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 120
Top = 120
End
Begin VB.CommandButton Command2
Caption = "返 回"
Height = 375
Left = 5160
TabIndex = 7
Top = 3360
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 375
Left = 3720
TabIndex = 6
Top = 3360
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H000040C0&
Height = 675
Left = 3360
TabIndex = 2
Top = 840
Visible = 0 'False
Width = 3135
End
Begin VB.Label Label8
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 3480
TabIndex = 10
Top = 2400
Width = 2895
End
Begin VB.Label Label7
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 375
Left = 240
TabIndex = 9
Top = 3240
Width = 3135
End
Begin VB.Label Label6
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 240
TabIndex = 8
Top = 2400
Width = 2895
End
Begin VB.Label Label5
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 3480
TabIndex = 5
Top = 1680
Width = 2895
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 240
TabIndex = 4
Top = 1680
Width = 2895
End
Begin VB.Label Label3
Alignment = 2 'Center
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 3480
TabIndex = 3
Top = 960
Width = 2895
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 240
TabIndex = 1
Top = 960
Width = 2895
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "找 回 密 码"
BeginProperty Font
Name = "隶书"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 240
TabIndex = 0
Top = 120
Width = 6135
End
End
Attribute VB_Name = "FormForget"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim I As Integer
Dim J As Integer
Dim UserName As String
Dim UserAns As Integer
Dim SQL As String
Dim Ques As String
Dim Answer As String
Dim PwMD5 As String
Dim Ch As New Class1
Dim Ans As String
Dim Chance As Integer
Dim Sec As Integer
Dim pw1 As String
Dim pw2 As String
Private Sub Command1_Click()
PwMD5 = Ch.DigestStrToHexStr(pw1)
DataEnvironment1.Commands(2).CommandType = adCmdText
SQL = "update usr set [password] = '" & PwMD5 & "' where [name] = '" & UserName & "'"
DataEnvironment1.rsCommand2.Open SQL
Timer3.Enabled = True
Sec = 0
Call Timer3_Timer
End Sub
Private Sub Command2_Click()
Label1.Caption = "返 回 操 作"
Sec = 0
Timer2.Enabled = True
Call Timer2_Timer
End Sub
Private Sub Form_Load()
I = 0
J = 0
Chance = 0
Sec = 0
I = 1
Label1.Caption = "找 回 密 码 " & I & "/3"
Label2.Caption = "输入用户名:"
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Text1.Left = 3360
Text1.Top = 840
Text1.Visible = True
End Sub
Private Sub Step1()
I = 1
Label1.Caption = "找 回 密 码 " & I & "/3"
Label2.Caption = "输入用户名:"
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Text1.Left = 3360
Text1.Top = 840
Text1.Visible = True
Text1.SetFocus
End Sub
Private Sub Step2()
I = 2
Label1.Caption = "找 回 密 码 " & I & "/3"
End Sub
Private Sub Step31()
I = 3
J = 1
Label1.Caption = "找 回 密 码 " & I & "/3"
Label2.Caption = "你的新密码"
Label3.Caption = ""
Label4.Caption = "再次输入"
Label5.Caption = ""
Text1.Left = 3360
Text1.Top = 840
Text1.Visible = True
Text1.Text = ""
Text1.PasswordChar = "*"
Text1.SetFocus
End Sub
Private Sub Step32()
I = 3
J = 2
Label1.Caption = "找 回 密 码 " & I & "/3"
Text1.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case I
Case 1
UserName = Text1.Text
Text1.Visible = False
DataEnvironment1.Commands(2).CommandType = adCmdText
SQL = "select * from usr where name='" & UserName & "'"
DataEnvironment1.rsCommand2.Open SQL
If DataEnvironment1.Recordsets(2).EOF Then
Label8.Caption = "用户名不存在"
DataEnvironment1.Recordsets(2).Close
Text1.Text = ""
Call Step1
Else
Ques = DataEnvironment1.rsCommand2.Fields(4)
Answer = DataEnvironment1.rsCommand2.Fields(5)
Label8.Caption = ""
Label6.Caption = UserName
Label2.Caption = "密码问题"
Label3.Caption = Ques
Label4.Caption = "问题答案"
Text1.Visible = True
Text1.Left = 3360
Text1.Top = 1560
Text1.Text = ""
Text1.SetFocus
DataEnvironment1.Recordsets(2).Close
Call Step2
End If
Case 2
Ans = Ch.DigestStrToHexStr(Text1.Text)
If Ans = Answer Then
Label7.Caption = "回答正确"
Call Step31
Else
Chance = Chance + 1
If Chance = 3 Then
Timer1.Enabled = True
Call Timer1_Timer
Else
Label7.Caption = "错误,还有 " & 3 - Chance & " 次机会"
Text1.Text = ""
Call Step2
End If
End If
Case 3
Select Case J
Case 1
pw1 = Text1.Text
Label8.Caption = "密码已记录"
Text1.Text = ""
Text1.Top = 1560
Text1.Left = 3360
Text1.SetFocus
Call Step32
Case 2
pw2 = Text1.Text
If pw1 <> pw2 Then
Label8.Caption = "两次不一致"
Call Step31
Else
Command1.Visible = True
Command1.SetFocus
End If
End Select
End Select
End If
End Sub
Private Sub Timer1_Timer()
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label8.Caption = ""
Command1.Visible = False
Command2.Visible = False
Text1.Visible = False
Label7.Caption = "错误 " & 3 - Sec & " 秒退出"
If Sec = 3 Then Unload Me
Sec = Sec + 1
End Sub
Private Sub Timer2_Timer()
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label8.Caption = ""
Command1.Visible = False
Command2.Visible = False
Text1.Visible = False
Label7.Caption = 3 - Sec & " 秒返回登录"
If Sec = 3 Then
Unload Me
Formlogin.Show
End If
Sec = Sec + 1
End Sub
Private Sub Timer3_Timer()
Label2.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label8.Caption = ""
Command1.Visible = False
Command2.Visible = False
Text1.Visible = False
Label7.Caption = "成功 " & 3 - Sec & " 秒返回"
If Sec = 3 Then
Unload Me
Formlogin.Show
End If
Sec = Sec + 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -