Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter
- from tkinter import *
- from tkinter import ttk
- def checkusername(user_name):
- for line in open("accountfile.txt", "r").readlines(): # Read the lines
- login_info = line.split() # Split on the space, and store the results in a list of two strings
- if user_name == login_info[0]:
- print("Correct credentials!")
- return False
- def register():
- file = open("accountfile.txt", "a")
- username = input("Enter User Name:")
- print(checkusername(username))
- while (checkusername(username) == False):
- username = input("Already exisit, Enter User Name:")
- file.write(username)
- file.write(" ")
- password = input("Enter Password: ")
- file.write(password)
- file.write("\n")
- file.close()
- if login():
- print("You are now logged in...")
- else:
- print("You aren't logged in!")
- def login():
- username = input("Please enter your username")
- password = input("Please enter your password")
- for line in open("accountfile.txt", "r").readlines(): # Read the lines
- login_info = line.split() # Split on the space, and store the results in a list of two strings
- if username == login_info[0] and password == login_info[1]:
- print("Correct credentials!")
- return True
- print("Incorrect credentials.")
- return False
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement