Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. import time
  2. import random
  3. import sys
  4. import csv
  5.  
  6. #setting certain values
  7. menu = 1
  8. inmenu = 0
  9. debug = 0
  10.  
  11. #globalising certain modules
  12. global username
  13. username = "."
  14. global password
  15. password = "."
  16. global check1
  17. check1 = "."
  18. global check2
  19. check2 = "."
  20.  
  21. def inmenu():
  22. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  23. print("")
  24. print("aaaaaaaaaaa")
  25. print("")
  26. print("❶ Login")##Referenced both number symbols from http://coolsymbol.com
  27. print("❷ Register")
  28. print("")
  29. menuchoice = input("Enter your choice: ")
  30. if menuchoice == "1" or menuchoice == "one" or menuchoice == "login":
  31. time.sleep(0.3)
  32. login()
  33. elif menuchoice == "2" or menuchoice == "two" or menuchoice == "register":
  34. time.sleep(0.3)
  35. register()
  36. else:
  37. import error#Using another python file I made (/JordanB$/Practical CS/time
  38. menu()
  39.  
  40.  
  41. def login():
  42. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  43. print("Let's log in...")
  44. global check1
  45. global check2
  46. global username
  47. username = input("Enter your username ")
  48. global password
  49. password = input("Enter your password ")
  50. with open('usernames.txt', 'r') as searchfile:
  51. for line in searchfile:
  52. if username in line:
  53. check1 = "complete"
  54. if check1 == "complete":
  55. with open('usernames.txt', 'r') as searchfile:
  56. for line in searchfile:
  57. if password in line:
  58. check2 = "complete"
  59. inmenu()
  60. if check1 != "complete" or check2 != "complete":
  61. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  62. print("✦✦✦ Invalid details, please sign up.")
  63. time.sleep(3)
  64. # if check2 != "complete":
  65. # print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  66. # print("✦✦✦ Invalid password, please sign up.")
  67. # time.sleep(3)
  68.  
  69. def register():
  70. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  71. print("Let's sign up...")
  72. global username
  73. username = input("Enter your desired username ")
  74. global password
  75. password = input("Enter a password ")
  76. fh = open("usernames.txt","a")
  77. lines_of_text = [username, " - ", password, "\n"]
  78. fh.writelines(lines_of_text)
  79. fh.close()
  80. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  81. print("✦✦✦ You have successfully registered!")
  82. time.sleep(3)
  83.  
  84. while menu == True:
  85. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
  86. print("")
  87. print("Katarina's Dice Game")
  88. print("")
  89. print("❶ Login")##Referenced both number symbols from http://coolsymbol.com
  90. print("❷ Register")
  91. print("")
  92. menuchoice = input("Enter your choice: ")
  93. if menuchoice == "1" or menuchoice == "one" or menuchoice == "login":
  94. time.sleep(0.3)
  95. login()
  96. elif menuchoice == "2" or menuchoice == "two" or menuchoice == "register":
  97. time.sleep(0.3)
  98. register()
  99. else:
  100. import error#Using another python file I made (/JordanB$/Practical CS/time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement