Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This function returns true if the account with the given username (and, optionally, password) exists, false otherwise.
- function getAccount(username, password)
- local dbNode = getDatabaseHandler()
- if not dbNode then
- return false
- end
- local accountQuery
- if password then
- accountQuery = dbQuery(dbNode, "SELECT ID FROM accounts WHERE username = ? AND password = ?", username, password)
- else
- accountQuery = dbQuery(dbNode, "SELECT ID FROM accounts WHERE username = ?", username)
- end
- local accountResult, numRows = dbPoll(accountQuery, -1)
- dbFree(accountQuery)
- return (numRows > 0 and true) or false
- end
Add Comment
Please, Sign In to add comment