I was trying to create a login stack where if the user is under the category of "admin" it enabled all the full access my application such as add, delete, edit and etc. however if it is under the category "user" it has limited access. I have code here, but it displayed all the data of my users. I just want to display the that the user who logged in is "admin" or "user" and can you teach me on how can I create a function or command for the full access/features for "admin" and "User". Hope you can help me. Thanks in advance.
Code: Select all
on mouseUp
local lDatabaseFile
global gDatabaseID
put specialFolderPath("Documents") & "\DCMA.db" into lDatabaseFile
if there is no file lDatabaseFile then
Beep
Answer Error "No Database Found!" titled " Dental Clinic Management Application"
else
put revOpenDatabase("Sqlite", lDatabaseFile) into gDatabaseID
put the text of fld "UserNameFld" into tUser
put the text of fld "PasswordFld" into tPassword
put "SELECT Password FROM TBLUSERS WHERE UserName='" & tUser & "'" into tSQLStatement
put "SELECT UserName,Category FROM TBLUSERS" into tPrivilege
put revDataFromQuery(tab,return, gDatabaseID, tSQLStatement) into tRecords
put revDataFromQuery(tab,return, gDatabaseID, tPrivilege) into tUSerRights
if fld "UserNameFld" is empty or fld "PasswordFld" is empty then
answer error "Please fill up the login"
else
if tRecords = tPassword then
answer "your account type is" &tUSerRights
go to stack "DashBoard"
RevCloseDatabase (gDatabaseID)
else
answer error "Bad password"
end if
end if
end if
end mouseUp