Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. >import sqlite3
  2. >import time
  3. >import datetime
  4. >import random
  5. >
  6. >conn = sqlite3.connect('password.db')
  7. >c = conn.cursor()
  8. >
  9. >def create_table():
  10. > c.execute("CREATE TABLE IF NOT EXISTS passwords(unix REAL, datestamp TEXT, >username TEXT, password TEXT)")
  11. >
  12. >create_table()
  13. >
  14. >def begin():
  15. > print("would you like to login or register")
  16. > option = input("login[1], register[2]")
  17. > if option == '1':
  18. > print("login")
  19. > elif option == '2':
  20. >
  21. > print("registerration form")
  22. > else:
  23. > print("that is not an option")
  24. > begin()
  25. >
  26. >begin()
  27. >
  28. >
  29. >
  30. >def register():
  31. > firstname = input("what is your first name:")
  32. > surname = input("what is you surname:")
  33. > print("so yore full name is:", firstname, surname)
  34. > username = surname[0] + surname[1] + surname[2] >+firstname[0]+str(len(surname))
  35. > print ("your username is:", username)
  36. > password1 = input("what is your password:")
  37. > password2 = input("Pleas repeat that password:")
  38. > if password1 == password2:
  39. > print("your password is:", password1)
  40. > print("your account has been registerd")
  41. > else:
  42. > register()
  43. >
  44. >register()
  45. >
  46. >
  47. >def dynamic_data_entry():
  48. >
  49. > unix = int(time.time())
  50. > date = str(datetime.datetime.fromtimestamp(unix).strftime('%Y-%m-%d >%H:%M:%S'))
  51. >
  52. > c.execute("INSERT INTO passwords (unix, datestamp, username, password) >VALUES (?, ?, ?, ?)",
  53. > (unix, date, username, password1))
  54. >
  55. > conn.commit()
  56. >
  57. >dynamic_data_entry()
  58. >
  59. >c.close
  60. >conn.close()
  61.  
  62. >Traceback (most recent call last):
  63. > File "C:UserscalluDesktoppassword woorkin ;).py", line 56, in <module>
  64. > dynamic_data_entry()
  65. > File "C:UserscalluDesktoppassword woorkin ;).py", line 52, in >dynamic_data_entry
  66. > (unix, date, username, password1))
  67. >NameError: name 'username' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement