Guest User

Untitled

a guest
Jun 26th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. def register():
  2. username = input("Please input your desired usernamen")
  3. password = input("Please input your desired passwordn")
  4. file = open("accountfile.txt", "a")
  5. file.write(username)
  6. file.write(" ")
  7. file.write(str(password))
  8. file.write("n")
  9. file.close()
  10. if login():
  11. print("You are now logged in...")
  12. else:
  13. print("You aren't logged in!")
  14.  
  15.  
  16. def login():
  17. username = input("Please enter your usernamen")
  18. password = input("Please enter your passwordn")
  19. for line in open("accountfile.txt", "r").readlines():
  20. login_info = line.split()
  21. if username == login_info[0] and password == login_info[1]:
  22. print("Correct credentials!")
  23. return True
  24. print("Incorrect credentials.")
  25. return False
Add Comment
Please, Sign In to add comment