Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import sqlite3
- db = sqlite3.connect('userdetails.db')
- cursor = db.cursor()
- #start
- time.sleep(1)
- print(' Please Select An Option Below')
- menu = input(""" Login - Sign up
- """)
- print('------------------------------------------')
- time.sleep(1)
- #sign up
- if menu == "Sign up":
- sign_1 = input ("""Please enter a new username
- """)
- sign_2 = input ("""Please enter a new password
- """)
- time.sleep(1)
- print('------------------------------------------')
- print('Account successfully created')
- print(' - ')
- time.sleep(2)
- print('Hey there ' + sign_1 + ' thanks for signing up!')
- time.sleep(1.4)
- print(' - ')
- print('Run the script again and log in with your new account')
- cursor.execute('INSERT INTO detail(usernames, passwords)VALUES(?,?)', (sign_1, sign_2))
- db.commit()
- quit()
- #login
- elif menu == "Login":
- login_1 = input ("""Please enter your username
- """)
- login_2 = input ("""Please enter your password
- """)
- find_user = ("SELECT * FROM detail WHERE usernames = ? AND passwords = ?")
- cursor.execute(find_user,[(login_1),(login_2)])
- results = cursor.fetchall()
- if results:
- for i in results:
- print('welcome')
- else:
- print('Incorrect Details')
- again = input('Would you like to try again (y/n')
- if again == "y":
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement