Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function that checks whether a username is already being used
- function doesUsernameExist ( username )
- if ( querySingle( "SELECT * FROM accounts WHERE username=? LIMIT 1", username ) ) then
- return true
- else
- return false
- end
- end
- -- Function that checks if the username and password are matching
- function checkLogin ( username, password )
- if ( querySingle( "SELECT * FROM accounts WHERE username=? AND password=? LIMIT 1", username, md5( username ) ) ) then
- return true
- else
- return false
- end
- end
- -- Function that creates a new account
- function createAccount ( username, password, email )
- if ( exec( "INSERT INTO accounts SET username=?, password=?, email=?", username, md5( username ), email ) ) then
- return true
- else
- return false
- end
- end
- -- Function that removed a account
- function deleteAccount ( username )
- if ( exec( "DELETE FROM accounts WHERE username=?", username ) ) then
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement