Guest User

Untitled

a guest
Apr 8th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import MySQLdb
  4. import sys
  5. import types
  6. import time
  7.  
  8. print("Welcome to Terzo's Reg Program!")
  9. time.sleep(1)
  10.  
  11. userName = str(input("Enter the account name you want to use: "))
  12. myEmail = str(input("Enter the email you would like to use: "))
  13. myQuestion = str(input("Enter your secret question: "))
  14. idNumber = str(input("Enter an ID number: "))
  15. myPassword = str(input("Enter your password: "))
  16. myPassworda = str(input("Enter your password again: "))
  17.  
  18. if myPassword == myPassworda:
  19. print("Your info is :")
  20. print("Name: ", userName)
  21. print("Email: ", myEmail)
  22. print("Question: ", myQuestion)
  23. print("ID Number", idNumber)
  24. print("Password: ", myPassword)
  25. else:
  26. print("Passwords did not match!")
  27. sys.exit()
  28.  
  29.  
  30. db = MySQLdb.connect(host="localhost", port=3306, user="root", passwd="test", db="account_zf")
  31. cursor = db.cursor()
  32. sql = """INSERT into account(name, email, phone, idnumber, password)
  33. VALUES (userName, myEmail, myQuestion, idNumber, myPassword)"""
  34. try:
  35. cursor.execute(sql)
  36. db.commit()
  37. print("Your account has been created!")
  38. except:
  39. db.rollback()
  40. print("Account was not created cause you fail D:")
  41. db.close()
Add Comment
Please, Sign In to add comment