Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >import sqlite3
- >import time
- >import datetime
- >import random
- >
- >conn = sqlite3.connect('password.db')
- >c = conn.cursor()
- >
- >def create_table():
- > c.execute("CREATE TABLE IF NOT EXISTS passwords(unix REAL, datestamp TEXT, >username TEXT, password TEXT)")
- >
- >create_table()
- >
- >def begin():
- > print("would you like to login or register")
- > option = input("login[1], register[2]")
- > if option == '1':
- > print("login")
- > elif option == '2':
- >
- > print("registerration form")
- > else:
- > print("that is not an option")
- > begin()
- >
- >begin()
- >
- >
- >
- >def register():
- > firstname = input("what is your first name:")
- > surname = input("what is you surname:")
- > print("so yore full name is:", firstname, surname)
- > username = surname[0] + surname[1] + surname[2] >+firstname[0]+str(len(surname))
- > print ("your username is:", username)
- > password1 = input("what is your password:")
- > password2 = input("Pleas repeat that password:")
- > if password1 == password2:
- > print("your password is:", password1)
- > print("your account has been registerd")
- > else:
- > register()
- >
- >register()
- >
- >
- >def dynamic_data_entry():
- >
- > unix = int(time.time())
- > date = str(datetime.datetime.fromtimestamp(unix).strftime('%Y-%m-%d >%H:%M:%S'))
- >
- > c.execute("INSERT INTO passwords (unix, datestamp, username, password) >VALUES (?, ?, ?, ?)",
- > (unix, date, username, password1))
- >
- > conn.commit()
- >
- >dynamic_data_entry()
- >
- >c.close
- >conn.close()
- >Traceback (most recent call last):
- > File "C:UserscalluDesktoppassword woorkin ;).py", line 56, in <module>
- > dynamic_data_entry()
- > File "C:UserscalluDesktoppassword woorkin ;).py", line 52, in >dynamic_data_entry
- > (unix, date, username, password1))
- >NameError: name 'username' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement