log in system that terminates the user after 3 attempts

can anyone pls help me with this.. ngtry pu kz q gumawa kaso di xa nagteterminate ih.. di xa ngloloop hanggang maging 3 ung Counter.. pahelp nman pu...(T-T) e2 ung codes q: Private Sub Command1_Click() Dim Counter As Integer If txtUserName = x Then Call PasswordOption Else MsgBox "Access Denied!" txtUserName.SetFocus Counter = Counter + 1 SendKeys "{Home}+{End}" End If If Counter = 3 Then MsgBox "You reached the maximum attempts allowed to log in. System is now terminating.." End End If End Sub Private Sub PasswordOption() If txtPassword = y Then MsgBox "Welcome! Login succeded!" Else MsgBox "Access denied!" txtPassword.SetFocus SendKeys "{Home}+{End}" Counter = Counter + 1 If Counter = 3 Then MsgBox "System will now terminate!", , "MIS" End End If End If End Sub Private Sub Form_Load() Counter = 0 End Sub PS: im just a newbie so pls explain to me ur suggestion in a way that a beginner will understand.. thanks pu sa mga mag-aaksaya ng oras 2mulong sken... heheh..
Submitted bycedon Fri, 02/12/2010 - 09:49

dito nalang ako compile huh kasi wala me sa pc ko hehehe try mo to 'declare it globally Dim rs as ADODB.Recordset Dim Counter as Integer 'sa form load Private Sub Form_Load() Call connection counter = 0 End Sub 'assume that eto ay command for login 'place the code below (command1) Set rs = New ADODB.Recordset 'condition for counter if counter = 3 then end the program or validate the user If counter = 3 then end With rs .Open "Select * from administrator WHERE username = '" & txtUserName.Text & "' and password = '" & txtPassword.Text & "' ", conn, adOpenStatic, adLockOptimistic If .EOF Then 'txtUserName.Text = "" txtPassword.Text = "" txtPassword.SetFocus MsgBox "Invalid Username & Password!", vbExclamation, "User Authentication" 'set counter ++ counter = counter + 1 Else 'Unload Me 'show form here for admin MsgBox "Correct Username & Password!", vbInformation, "User Authentication" txtUserName.Text = "" txtPassword.Text = "" txtUserName.SetFocus End If End With sana makatolong hehehe :) [email protected]

kuya thanks pu.... :) ttry q 2.. mdali nga xa intindihin.. :) kso me d aq alam d2,.. ung ADODB.. bhala n, heheh.. i guess i'll just have to study more.. heheh.. thanks pu ulet... :) muahz.. :)
Submitted bycidfreyon Sun, 02/14/2010 - 00:13

In reply to by ced

Dudes alam mo ba kung pano ung pag nag fail ng 3 times sa log in lock na ung buong system? Ung iba kse pag nag fail ng 3 times pwede ulit i-run. Ang nsa isip ko pag nag fail ng 3 times lock na ung system ndi na pwede i-run. At syempre pano din ung pag unlock nya hehehe.

dapat lock lang ung account kasi pag lock ung buong system edi damay ung ibang account na hindi naman nakapag 3 attempts. tama ung sinabi ni C_SharpShooter maglagay k lng ng additional column mu sa user table let say "Attempt" n nandun ung maximum attempt ng every user at every failed log in babawasan mu xa.tapos che2ck mu din xa every log in pra malaman mu kung lock n ung account nya. cmpre you need to put another module na mag aunlock nung mga na lock n account and that is for admin rights only.

I want to do this because of too many people who want to hack some of my system. I mean this is requested by my client so I have to do it. I'm not talking about DTR thing which only one employee will be lock. What I mean is the whole thing like the log in of admin and failing then lock the whole system. This is for the safety of my client's system ok?

What type of system ba ito? Maraming klase para ilock ang system kung gusto mong wag ng gumana... Then unlocking mechanism mo kung gusto mong online unlocking or via user license, system update, etc...

DTR(including payroll)+Inventory+Information only. Of course kung mala-lock ung system I also need the solution pra ma-unlock. ^_^ Hindi ko kse close ung nakita kong may ari ng system na may lock e kya hindi ko natanong.

Choices mo for locking.. * via file (remove a dll, create a dummy file, checksum, etc.) * registry * ini file * database locking To unlock the system, eto lang mechanism mo * real-time updates * fix-tools * system upgrade

I got an idea, you mentioned the database. Well i'll just lock the database (not the whole program) just in case there is someone who will manipulate it using vb. And also i'll put password on the database. Thank you very much ^_^
Submitted byd4xyjenon Mon, 02/15/2010 - 07:43

In reply to by ced

may ginawa ako dati na ganyan finake ko lng gumawa ako ng isang label na not visible as my counter para sa mga msgbox ko try mo po to Dim ctr As Integer Private Sub CMDOK_Click() With adoUser.Recordset .MoveFirst While Not .EOF If txtuser.Text = "" Or txtpass.Text = "" Then MsgBox "The system requires Username and Password." + vbCrLf + "Fill up all entries!", vbInformation, "MsgBox" txtuser.SetFocus Exit Sub Else If ctr 1 Then MsgBox "Invalid Entry, Check USERNAME and PASSWORD! You Only Have " & Label3 & " Tries Remaining Before The Program Exits.", vbInformation, "ADMINISTRATOR" Else MsgBox "Invalid Entry, Check USERNAME and PASSWORD! You Only Have " & Label3 & " Try Remaining Before The Program Exits.", vbInformation, "ADMINISTRATOR" End If End Sub
Submitted byAnonymous (not verified)on Mon, 03/18/2013 - 15:23

In reply to by ced

Hindi mo dineklare yun connection cn = "Provider"
Submitted byemondon Fri, 02/12/2010 - 10:21

Option Explicit Public LoginSucceeded As Boolean Dim bytretries As Byte Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Me.Hide End Sub Private Sub cmdOK_Click() 'On Error Resume Next Dim SQL, path As String path = App.path With ADO .CommandType = adCmdText .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & "\Employee.mdb;Persist Security Info=False" .RecordSource = "Select * from Users" .Refresh .Recordset.MoveFirst Do Until .Recordset.EOF If (LCase$(.Recordset.Fields("Password")) = LCase$(txtPassword.Text)) And (LCase$(.Recordset.Fields("Username")) = LCase$(txtUserName.Text)) Then MsgBox "A C C E S S G R A N T E D !!" Me.Hide Load frmMain frmMain.Show Exit Sub Else .Recordset.MoveNext End If Loop txtUserName.Text = "" txtPassword.Text = "" MsgBox "A C C E S S D E N I E D !!", vbExclamation + vbOKOnly, "" txtUserName.SetFocus ' SendKeys "{Home}+{End}" '--------------------------------------------- 'after 3 retries, quit If bytretries = 2 Then MsgBox "Guessing is not allowed!!", vbCritical, " - Security" End Else bytretries = bytretries + 1 End If End With End Sub

Additional lang: Kung 3 trials lang then locked na yung account nya, need to put a status sa users_table na nalock na yung account nya.... (kung 3 attempts per day trial, etc ) Dapat yung login process mo before at hand ay nagchecheck na kung locked yung account

Additional lang: Kung 3 trials lang then locked na yung account nya, need to put a status sa users_table na nalock na yung account nya.... (kung 3 attempts per day trial, etc ) Dapat yung login process mo before at hand ay nagchecheck na kung locked yung account
Submitted bycidfreyon Sun, 02/14/2010 - 00:21

'declair first lahat ng connection mo Dim dbLogin As New ADODB.Connection Dim rsLogin As New ADODB.Recordset Dim ctr As Byte Private Sub cmdLogin_Click() OpenConn dbLogin, rsLogin, "SELECT * FROM tblUsers WHERE UserName='" & txtUser.Text & "' AND PassWord='" & txtPass.Text & "'" With rsLogin If .EOF = True Then MsgBox "Incorrect username or password.", vbCritical ctr = ctr + 1 txtUser.Text = "" txtPass.Text = "" txtUser.SetFocus Else MsgBox "Welcome", vbInformation Form1.Show Unload Me End If End With exitSub: CloseConn rsLogin, dbLogin If ctr = 3 Then MsgBox "You have attempted to login three (3) times. Program will now close.", vbInformation End End If End Sub It works fine with my system hopefully it will give you an idea ^_^
Submitted byAnonymous (not verified)on Wed, 02/17/2010 - 20:59

sales and inventory system of an ice cream business,. yan poh ang naassign smin,. bka meon poh s inyo ang nkpaggwa n ng ganun,. pahelp nmn poh,. ok kung my idea poh kau,. ..hirap kc eh,. lalo n ung part ng inventory,. d koh lam kung panoh ipapakita/ilalagay s dbase ung stocks nung products,. ..tapos kung pano babawas ng automatic sa stocks kapag nakabenta,. ..sounds easy peo d nmin magawa,. ..kc nmn e2 ung line up ng products huh,. ..may fields n,. products, flavors, quantity, amount/price,. ..kunyari, product=cream cup, flavors=chocolate, ube, vanilla, cheese,. quantity=100,. price=15.00 ..naguguluhan kmi, kc daming flavors,... ,.basta gnun,. help nmn.,
Submitted byAnonymous (not verified)on Wed, 03/03/2010 - 20:25

anyone help me in my program........? how to make a log in with 3 attempts
Submitted byAnonymous (not verified)on Wed, 03/10/2010 - 02:01

Private Sub Command1_Click() Dim Counter As Integer If txtUserName = x Then Call PasswordOption Else MsgBox "Access Denied!" txtUserName.SetFocus Counter = Counter + 1 SendKeys "{Home}+{End}" End If If Counter = 3 Then 'gwa k ng lblcounter den add mu tong code na..newbie din aq, but try mu qng mkakatulong.. lblcounter.text=counter MsgBox "You reached the maximum attempts allowed to log in. System is now terminating.." End End If End Sub Private Sub PasswordOption() If txtPassword = y Then MsgBox "Welcome! Login succeded!" Else MsgBox "Access denied!" txtPassword.SetFocus SendKeys "{Home}+{End}" Counter = Counter + 1 If Counter = 3 Then MsgBox "System will now terminate!", , "MIS" End End If End If End Sub Private Sub Form_Load() Counter = 0 End Sub
Submitted byAnonymous (not verified)on Wed, 03/10/2010 - 02:03

if you need more explanation or help..contact me.bga makatulong aq sau khit [email protected]

Add new comment