Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. def login():
  2.     while True:
  3.         username = input("Please enter your username ")
  4.         password = input("Please enter your password ")
  5.         with sqlite3.connect("Timetable.db") as db:
  6.             cursor = db.cursor()
  7.         find_user = ("SELECT * FROM students WHERE username = ? AND password = ?")
  8.         cursor.execute(find_user,[(username),(password)])
  9.         results = cursor.fetchall()
  10.         if results:
  11.             print("Welcome")
  12.             break
  13.         else:
  14.             print("Username and password wrong ")
  15.             again = input("try again? (y/n):  ")
  16.             if again.lower() == "n":
  17.                 print("bye")
  18.                 time.sleep(1)
  19.                 break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement