Skip to content

Instantly share code, notes, and snippets.

@DanielHarman
Last active August 29, 2015 14:15
Show Gist options
  • Save DanielHarman/6dbb8b32e75c1b994568 to your computer and use it in GitHub Desktop.
Save DanielHarman/6dbb8b32e75c1b994568 to your computer and use it in GitHub Desktop.
cur.execute("SELECT * FROM users") #Query the database and retrieve all entries from the user table
rows = cur.fetchall() #Place request information in an array
#Iterate through the array
for row in rows:
#Check if the username and password entered match any entries in the database
if (row[1] == username and row[2] == password):
#If they do we want to set the objects variables to the accounts information
self.userid = row[0] #Set id
self.username = username #Set username
self.isValid = True #Set that the account has been validated
self.name = row[3] #Set the name of the account
#Check if the account is also an admin
if (row[4] == 1):
self.isadmin = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment