Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. import os
  2. #Variables
  3. FileName = "Password.txt"
  4.  
  5. #Functions
  6. def Begin():
  7.     a = raw_input("What would you like to do?: ").lower()
  8.     if(a == "login"):
  9.         Login()
  10.  
  11.     elif(a == "create"):
  12.         Create()
  13.  
  14.     else:
  15.         Error()
  16.  
  17. def Login():
  18.     if(os.path.isfile(FileName)):
  19.         nUser = "usr" + raw_input("Username: ").lower()
  20.         nPass = "pass" + raw_input("Password: ").lower()
  21.         iLogin = open(FileName, "r")
  22. #        if(iLogin.search(nUser + nPass)):
  23. #            print("Thank you for loggin in.")
  24. #            return 0
  25. #        for line in iLogin:
  26. #            LoginInformation = line
  27. #            break
  28.        
  29. #        if(LoginInformation.search(nUser + nPass)):
  30. #            print("Thank you for logging in.")
  31. #            return 0
  32.            
  33.     Error()
  34.  
  35. def Create():
  36.     if(os.path.isfile(FileName)):
  37.         print("You already have an account. Delete Password.txt to create a new one.")
  38.         Begin()
  39.  
  40.     Pass = open(FileName, "w")
  41.     b = raw_input("Username: ").lower()
  42.     c = raw_input("Password: ").lower()
  43.     Pass.writelines("usr" + b + " , " + "pass"+ c)
  44.     Pass.close()
  45.     return 0
  46.  
  47. def Error():
  48.     print("You have entered an invalid response.")
  49.     Begin()
  50.  
  51. #Program
  52. print "Login or create an account below."
  53. Begin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement