Last active
August 29, 2015 14:15
-
-
Save DanielHarman/6dbb8b32e75c1b994568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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