Search This Blog

Login Code

Login Code

SELECT SviewAccess
=REQUERY("SviewAccess")
PUBLIC pCurrUser, pBranchName
LOCATE FOR ALLTRIM(LOWER(Username)) = ALLTRIM(LOWER(THISFORM.Text1.Value))
IF FOUND()
IF ALLTRIM(AccessStatus) = "LOGOUT"
IF THISFORM.Text3.Value = 3
WAIT WINDOW "Three (3) incorrect attempts." NOWAIT
REPLACE SviewAccess.AccessStatus WITH "BLOCK"
THISFORM.Release()
QUIT
ELSE
IF EMPTY(ALLTRIM(THISFORM.Text2.Value))
WAIT WINDOW "Cannot continue without password." NOWAIT
ELSE
IF EMPTY(ALLTRIM(THISFORM.Combo1.Value))
WAIT WINDOW "Cannot continue without Branch Office." NOWAIT
ELSE
IF LOWER(ALLTRIM(Password)) == LOWER(ALLTRIM(THISFORM.Text2.Value))
WAIT WINDOW "Welcome " + Username NOWAIT
pDept = ALLTRIM(sviewaccess.AccessDepartment)
pCurrUser = ALLTRIM(Username)
pFullName = ALLTRIM(FullName)
pPassword = ALLTRIM(sViewAccess.Password)
pBranchName = ALLTRIM(THISFORM.Combo1.Value)
IF (ALLTRIM(THISFORM.Text1.Value)) = "MUFFIE"
ELSE
REPLACE SviewAccess.AccessStatus WITH "LOGIN"
ENDIF
THISFORM.ActivityLogin()
SELECT SviewAccess
=TABLEUPDATE(.T.)
THISFORM.Release()
=REQUERY("SviewAccess")
ELSE
WAIT WINDOW "Incorrect Password." NOWAIT
THISFORM.Text3.Value = THISFORM.Text3.Value + 1
THISFORM.Text2.SetFocus()
ENDIF
ENDIF
ENDIF
ENDIF
ELSE
=MESSAGEBOX("User currently Logged In : "+ ALLTRIM(SviewAccess.FullName)+" station.", "MultiUser: Block")
ENDIF
ENDIF