Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def startup():
- with open('Admin.txt', 'w+') as q:
- q.write('Admin : Password')
- with open("Admin.txt", 'a+') as r:
- r.read()
- print ("Admin Username and Password has been set")
- home()
- def home():
- print("Do you want to create a new user (guest) or Log In?")
- log_user = input()
- if log_user == "Log In":
- login()
- elif log_user == "new user":
- new_user_maker()
- else:
- print ("Sorry that was not a valid option please try again")
- home()
- def new_user_maker():
- print("What is your name?")
- name = input()
- print("What is your age?")
- age = input()
- new_guest_user = name[0:3] + age
- print("Your username is: ", new_guest_user)
- print("What do you want as a password?")
- new_guest_pass = input()
- with open(new_guest_user + '.db', 'w') as w:
- w.write(new_guest_user + " : " + new_guest_pass)
- login()
- def login():
- print("You will now log in")
- print("Are you a Admin or Guest? ")
- user_type = input()
- if user_type == 'Admin':
- Admin_login()
- elif user_type == 'Guest':
- Guest_login()
- else:
- print("That is not an valid option sorry, please specify 'Admin' or 'Guest'")
- login()
- def Admin_login():
- print("You chose to be an admin")
- print("Please input your username: ")
- Admin_Name = input()
- print("Please input your password: ")
- Admin_Password = input()
- try:
- filename = Admin_Name + ".txt"
- with open(filename, 'r') as checking_user_and_pass:
- Admin_correct = checking_user_and_pass.read()
- if Admin_correct == Admin_Name + " : " + Admin_Password:
- print("You are now logged in as an admin")
- else:
- print ('Incorrect Username or Password')
- print ("Do you want to Try Again or log in as a different user")
- option = input ()
- if option == 'Try Again':
- Admin_login()
- except:
- print ('Incorrect Username or Password')
- print ("Do you want to Try Again or Log In as a different user")
- option = input()
- if option == "Try Again":
- Admin_login()
- else:
- print("You chose to be a different user")
- login()
- def Guest_login():
- print("You chose to be a guest")
- print("Please input your username: ")
- Guest_Name = input()
- print("Please input your password: ")
- Guest_Password = input()
- try:
- filename = Guest_Name + ".db"
- with open(filename, 'r') as checking_user_and_pass:
- Guest_correct = checking_user_and_pass.read()
- if Guest_correct == Guest_Name + " : " + Guest_Password:
- print("You are now logged in as", Guest_Name)
- else:
- print ('Incorrect Username or Password')
- print ("Do you want to Try Again or log in as a different user")
- option = input ()
- if option == 'Try Again':
- Guest_login()
- except:
- print ('Incorrect Username or Password')
- print ("Do you want to Try Again or Log In as a different user")
- option = input()
- if option == "Try Again":
- Guest_login()
- else:
- print("You chose to be a different user")
- login()
- startup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement