Sqlite3 Python - Check if a field > integer -
i have code check if he/sheis admin or not, how check if number in database higher required?
the field in table named adminlevel
def login(): def loggedin(): if adminlevel > 0: print("hello there admin!") print("commands: bet, deposit, logout") print("admin commands: ban, give credits") else: print("hello there {}".format(username)) print("commands: bet, deposit, logout") adminlevel = 0 username = input("please enter username: ") password = getpass("please enter password: ") admin = c.execute("select 1 accounts adminlevel > 0") c.execute("select 1 accounts username = ? , password = ?", (username, password)) if c.fetchone(): print('hello there! {}'.format(username)) loggedin() else: print("username , password not found!") login()
if c.fetchone(): c.execute("select 1 accounts adminlevel > 0") if c.fetchone(): print("hello there admin!") print("commands: bet, deposit, logout") print("admin commands: ban, give credits") else: loggedin()
just did this, forgot works same login.
Comments
Post a Comment