Advertisement
LaytonUK

Hia

Oct 25th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1.  def login():
  2.         print("Please enter the following below.\n")
  3.         user = input("Username: ")
  4.         passw = input("\nPassword: ")
  5.         f = open("users.txt", "r")
  6.         for line in f.readlines():
  7.             us, pw = line.strip().split("|")
  8.             if (user in us) and (passw in pw):
  9.                 time.sleep(1)
  10.                 print ("\nLogin successful!\n")
  11.                 time.sleep(0.5)
  12.                 print ("***************************************************************************************\n")
  13.                 menu()
  14.                 return True
  15.         time.sleep(1)
  16.         print ("\nWrong username/password\n")
  17.         time.sleep(0.5)
  18.         print ("***************************************************************************************\n")
  19.         return False
  20.  
  21.     def signup():
  22.         stringToSave = input("Enter your username and password like so... NAME|PASS : ")
  23.         file_name = "users.txt"
  24.         myFile = open("users.txt", 'a')
  25.         myFile.write(stringToSave + '\n')
  26.         myFile.close()
  27.         time.sleep(2)
  28.         print("Your account as been successfully created!\n")
  29.         time.sleep(2)
  30.         print ("***************************************************************************************\n")
  31.         main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement