Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. -- Function that checks whether a username is already being used
  2. function doesUsernameExist ( username )
  3.     if ( querySingle( "SELECT * FROM accounts WHERE username=? LIMIT 1", username ) ) then
  4.         return true
  5.     else
  6.         return false
  7.     end
  8. end
  9.  
  10. -- Function that checks if the username and password are matching
  11. function checkLogin ( username, password )
  12.     if ( querySingle( "SELECT * FROM accounts WHERE username=? AND password=? LIMIT 1", username, md5( username ) ) ) then
  13.         return true
  14.     else
  15.         return false
  16.     end
  17. end
  18.  
  19. -- Function that creates a new account
  20. function createAccount ( username, password, email )
  21.     if ( exec( "INSERT INTO accounts SET username=?, password=?, email=?", username, md5( username ), email ) ) then
  22.         return true
  23.     else
  24.         return false
  25.     end
  26. end
  27.  
  28. -- Function that removed a account
  29. function deleteAccount ( username )
  30.     if ( exec( "DELETE FROM accounts WHERE username=?", username ) ) then
  31.         return true
  32.     else
  33.         return false
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement