1 Replies - 682 Views - Last Post: 30 July 2008 - 07:35 PM Rate Topic: -----

#1 SEAHGIP  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-July 08

HOW DO I REFUSES THE ACCESS AFTER THREE INCORRECT NAME OR PASSWORD

Posted 30 July 2008 - 07:31 PM

Private Sub cmdLog_Click()
Dim var1 As Integer
Dim var2 As Integer

If txtName.Text = "SEAH GIAP SIANG" Then
	If txtPassword.Text <> "1234" Then
		Select Case var1
		Case Is <= 3
		MsgBox "The password is incorrect", vbExclamation, "INCORRECT PASSWORD"
		var1 = var1 + 1
		Case Else
		MsgBox "You have entered the wrong password too many times,the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
		Unload Me
		End Select
		Else
		frmWelcome.Hide
		'frmSplash.Show
	End If
	
Else
	Select Case var1
	Case Is <= var2
	MsgBox "The name is incorrect", vbExclamation, "INCORRECT NAME"
	var1 = var1 + 1
	Case Is <= var2
	MsgBox "You have entered the wrong name too many times, the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
	End
	End Select
   
End If
End Sub



** Edit ** :code:

Is This A Good Question/Topic? 0
  • +

Replies To: HOW DO I REFUSES THE ACCESS AFTER THREE INCORRECT NAME OR PASSWORD

#2 no2pencil  Icon User is online

  • Head MFIC
  • member icon

Reputation: 5068
  • View blog
  • Posts: 26,450
  • Joined: 10-May 07

Re: HOW DO I REFUSES THE ACCESS AFTER THREE INCORRECT NAME OR PASSWORD

Posted 30 July 2008 - 07:35 PM

You need to add some form of checking how many times the user tries to log in, & increment the value every time that they supply the wrong password.

		Dim Login_Error as Int
		Login_Error = 0

	While Login_Error < 3
	If txtPassword.Text <> "1234" Then
		Select Case var1
		Case Is <= 3
		MsgBox "The password is incorrect", vbExclamation, "INCORRECT PASSWORD"
		var1 = var1 + 1
		Case Else
		MsgBox "You have entered the wrong password too many times,the program will now terminate.", vbCritical, "TERMINATE THE PROGRAM"
		Unload Me
		End Select
		Else
		frmWelcome.Hide
		'frmSplash.Show
		Login_Error = Login_Error + 1
	End If
	End While


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1