Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @persist [Username Password Permission]:array
- # Library for Loginscreens etc.
- # by Magus/Lodkagan
- # Use the #include "" funxtion.
- # Functions
- #=============================================================================================================
- # addUser(string,string) - Adds a user, first string is the username, the second is the password,
- # *- with the permission number 1 (normal user).
- # addUser(string,string,number) - Adds a user, first string is the username, the second is the password,
- # *- the last number is the permission number.
- # getUserPermission(string) - Gets the Permission from the username.
- #getUserPermissionID(number) - Gets the Permission from the user ID.
- # deleteUserID(number) - Delete a user with the ID.
- # getUserID(number) - Gets the userID's name.
- # getUserName(string) - Gets the Username's ID.
- # getUserIDPassword(number) - Gets the userID's Password.
- # getUserList() - Returns a list with all Usernames.
- # checkUserPassword(strin,string) - Checks the Input with the Username and Password.
- # *- Returns 0 if Username or/and Password is wrong.
- # *- Returns 1 if both is right
- #=============================================================================================================
- function void addUser(UN:string, PW:string) {
- Username:pushString(UN:lower())
- Password:pushString(PW:lower())
- Permission:pushNumber(1)
- }
- function void addUser(UN:string, PW:string, PE:number) {
- Username:pushString(UN:lower())
- Password:pushString(PW:lower())
- Permission:pushNumber(PE)
- }
- function number getUserPermission(Name:string) {
- local I = 1
- while((Name:lower() != Username[I,string]) & (Username:exists(I))) {I++}
- if(Username:exists(I)) {return Permission[I,number]}
- else {return 0}
- }
- function number getUserPermissionID(I:number) {
- return Permission[I,number]
- }
- function void deleteUserID(ID:number) {
- Username:remove(ID)
- Password:remove(ID)
- }
- function string getUserIDName(I:number) {
- return Username[I,string]
- }
- function number getUserName(Name:string) {
- local I = 1
- while((Name:lower() != Username[I,string]) & (Username:exists(I))) {I++}
- if(Username:exists(I)) {return I}
- else {return 0}
- }
- function string getUserIDPassword(I:number) {
- return Password[I,string]
- }
- function string getUserList() {
- return Username:concat(", ")
- }
- function number checkUserPassword(UN:string, PW:string) {
- local I = 1
- while((UN:lower() != Username[I,string]) & (Username:exists(I))) {I++}
- if(UN:lower() == Username[I,string]) {
- if(PW:lower() == Password[I,string]) {return I}
- return 0
- }
- return 0
- }
Advertisement