SHARE
TWEET

Untitled

a guest Jun 5th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from datetime import datetime
  2. import time
  3. import string
  4. import random
  5. import sys
  6. import os
  7. # # # # # # #
  8. # Functions #
  9. # # # # # # #
  10. def changelog():
  11.     print("\nVersion 1.2.1\nAdded Levels\nCleaned Up Login Code")
  12.     print("\nVersion 1.2.2\nFinished Levels\nAdded Leveling Up To Functions 1-4")
  13.     print("\nVersion 1.2.3\nCleaned up level messages")
  14.     print("\nVersion 1.2.4\nAdded config\nHaving the option to enter debug mode\nor disable the admin mode\nadded the option to disable account creation")
  15.     print("\nVersion 1.2.4.1\nRemoved the chaning of passwords")
  16.     print("")
  17.     home1()
  18. def levelup():
  19.     f = open((username) + '.txt','r')
  20.     time.sleep(0.10)
  21.     f = f.readlines()
  22.     a = f[4]
  23.     a = float(a)
  24.     b = (float(a) + float(1))
  25.     f = open((username) + '.txt','w+')
  26.     level=(b)
  27.     f.write(("-= Info =- \n") + (username) + ("\n") + ("password") + ("\n-= Levels =-\n") + str(level))
  28.     f.close()
  29.     print (("Well Done! You Leveled Up To Level ") + str(level))
  30. def levels():
  31.     f = open((username) + '.txt','r')
  32.     time.sleep(0.10)
  33.     f = f.readlines()
  34.     a = f[4]
  35.     a = float(a)
  36.     print(("Your are currently level ") + str(a))
  37.     end=input("Press enter to continue")
  38.     if end=="0":
  39.         loggedin()
  40.     else:
  41.         loggedin()
  42. def generator():
  43.     import string
  44.     import random
  45.     import time
  46.  
  47.     possibleCharacters = string.ascii_lowercase + string.digits + string.ascii_uppercase + ' .,!?;:'
  48.  
  49.     target = input("Enter your target text: ")
  50.     attemptThis = ''.join(random.choice(possibleCharacters) for i in range(len(target)))
  51.     attemptNext = ''
  52.  
  53.     completed = False
  54.  
  55.     generation = 0
  56.  
  57.     while completed == False:
  58.         print(attemptThis)
  59.         attemptNext = ''
  60.         completed = True
  61.         for i in range(len(target)):
  62.             if attemptThis[i] != target[i]:
  63.                 completed = False
  64.                 attemptNext += random.choice(possibleCharacters)
  65.             else:
  66.                 attemptNext += target[i]
  67.         generation += 1
  68.         attemptThis = attemptNext
  69.         time.sleep(0.02)
  70.  
  71.     print("Target matched! That took " + str(generation) + " generation(s)")
  72.     levelup()
  73.     end=input("Type 1 to run again or 0 To Return home: ")
  74.     if end=="0":
  75.         loggedin()
  76.     else:
  77.         generator()
  78. def calc():
  79.     print("Welcome to the calculator")
  80.     print("0.Return Home")
  81.     print("1.Add")
  82.     print("2.Subtract")
  83.     print("3.Mutiply")
  84.     print("4.Divide")
  85.     main=input("Choice: ")
  86.     if main=="0":
  87.         loggedin()
  88.     if main=="1":
  89.         one=input("One: ")
  90.         two=input("Two: ")
  91.         total= float(one) + float(two)
  92.         print(total)
  93.         levelup()
  94.         close=input("Press Enter To Continue")
  95.         calc()
  96.     if main=="2":
  97.         one=input("One: ")
  98.         two=input("Two: ")
  99.         total= float(one) - float(two)
  100.         print(total)
  101.         levelup()
  102.         close=input("Press Enter To Continue")
  103.         calc()
  104.     if main=="3":
  105.         one=input("One: ")
  106.         two=input("Two: ")
  107.         total= float(one) * float(two)
  108.         print(total)
  109.         levelup()
  110.         close=input("Press Enter To Continue")
  111.         calc()
  112.     if main=="4":
  113.         one=input("One: ")
  114.         two=input("Two: ")
  115.         total= float(one) / float(two)
  116.         print(total)
  117.         levelup()
  118.         close=input("Press Enter To Continue")
  119.         calc()
  120.     else:
  121.         calc()
  122. # # # # # # #
  123. # User Area #
  124. # # # # # # #
  125. def loggedin():
  126.     time.sleep(1)
  127.     print("             "*2000)
  128.     print(("Welcome ") + (username) + (" To The Home Menu\n") + ("Options are listed below type one of them in to continue"))
  129.     print("0.Logout")
  130.     print("1.Change Your Password")
  131.     print("2.Use A Calculator")
  132.     print("3.Text Generator")
  133.     print("4.View Your Level")
  134.     main=input("Choice: ")
  135.     if main=="0":
  136.         home1()
  137.     if main=="1":
  138.         #password()
  139.         print("Module currently disabled")
  140.     if main=="2":
  141.         calc()
  142.     if main=="3":
  143.         generator()
  144.     if main=="4":
  145.         levels()
  146.     else:
  147.         loggedin()
  148. # # # # # # # # #
  149. #   Admin       #
  150. # # # # # # # # #
  151. def adminlogin():
  152.     if admin==("true"):
  153.         print("Admin Control Panel")
  154.         username=input("Username: ")
  155.         password=input("Password: ")
  156.         if username=="dan":
  157.             if password=="dan":
  158.                 print("Logged In")
  159.                 print("             "*2000)
  160.                 adminhome()
  161.             else:
  162.                 print("Login Failed, Returning Home")
  163.                 home1()
  164.         else:
  165.             print("Login Failed, Returning Home")
  166.             home1()
  167.     else:
  168.         print("Admin module disabled by config")
  169. def tempadminhome():
  170.     adminhome()
  171. def adminhome():
  172.     print("Options are listed below type one of them in to continue")
  173.     print("0.Logout")
  174.     print("1.Change a users login details")
  175.     print("2.Delete a user from the system")
  176.     main=input("Choice: ")
  177.     if main=="1":
  178.         adminpassword()
  179.     if main=="2":
  180.         deleteuser()
  181.     if main=="0":
  182.         home1()
  183.     else:
  184.         tempadminhome()
  185. def deleteuser():
  186.     print("Please enter the username of the user to delete enter '1' to return home")
  187.     user=input("Username: ")
  188.     if user=="1":
  189.         print("\n")
  190.         adminhome()
  191.     else:
  192.         try:
  193.             os.remove((user) + (".txt"))
  194.             print((user) + (" Removed from the system returning Home\n"))
  195.             adminhome()
  196.         except IOError:
  197.             print("User Doesn't exist in the system, Returning Home\n")
  198.             adminhome()
  199. def adminpassword():
  200.     print("Enter the users username and desired password, If the user doesn't exist one will be created")
  201.     username=input("Username: ")
  202.     password=input("Password: ")
  203.     f = open((username) + '.txt','w+')
  204.     time.sleep(0.10)
  205.     f = f.readlines()
  206.     a = f[4]
  207.     a = float(a)
  208.     f.write(("-= Info =- \n") + (username) + ("\n") + (password) + ("\n-= Levels =-\n") + ("1"))
  209.     f.close()
  210.     adminhome()
  211. # # # # # # # # #
  212. #    AUTH       #
  213. # # # # # # # # #
  214. def returnpasssword():
  215.     password()
  216. def password():
  217.     print("Please Relogin before chaning your password, type '1' to return home")
  218.     username=input("Username: ")
  219.     time.sleep(0.10)
  220.     if username=="1":
  221.         loggedin()
  222.     else:    
  223.         password=input("Password: ")
  224.         try:
  225.             f = open((username) + '.txt','r')
  226.             f = f.readlines()
  227.             a = f[1]
  228.             b = ((username) + ("\n"))
  229.             time.sleep(0.10)
  230.             if a==b:
  231.                 a = f[2]
  232.                 b = ((password) + ("\n"))
  233.                 time.sleep(0.10)
  234.                 if a==b:
  235.                     time.sleep(0.10)
  236.                     print("Please enter your new password")
  237.                     newpassword=input("Password: ")
  238.                     f = open((username) + '.txt','w+')
  239.                     f.write(("-= Info =- \n") + (username) + ("\n") + (password) + ("\n-= Levels =-\n") + ("1"))
  240.                     f.close()
  241.                     print(("Your new details are the following:\n") + ("Username: ") + (username) + ("\nPassword: ") + (newpassword))
  242.                     time.sleep(2)
  243.                     loggedin()
  244.                 else:
  245.                     print("Username Or Password Incorrect!")
  246.                     returnpasssword()
  247.             else:
  248.                 print("Username Or Password Incorrect!")
  249.                 returnpasssword()
  250.         except IOError:
  251.             print("Username Or Password Incorrect!")
  252.             returnpasssword()
  253. def login():
  254.     global username
  255.     global password
  256.     username=input("Username: ")
  257.     time.sleep(0.10)
  258.     password=input("Password: ")
  259.     try:
  260.         f = open((username) + '.txt','r')
  261.         f = f.readlines()
  262.         a = f[1]
  263.         b = ((username) + ("\n"))
  264.         time.sleep(0.10)
  265.         if a==b:
  266.             a = f[2]
  267.             b = ((password) + ("\n"))
  268.             time.sleep(0.10)
  269.             if a==b:
  270.                 time.sleep(0.10)
  271.                 f = open((username) + '.txt','r')
  272.                 time.sleep(0.10)
  273.                 f = f.readlines()
  274.                 a = f[4]
  275.                 a = float(a)
  276.                 print("Logged in")
  277.                 print("Sending you to Home")
  278.                 time.sleep(0.25)
  279.                 loggedin()
  280.             else:
  281.                 print("Username Or Password Incorrect!")
  282.                 home1()
  283.         else:
  284.             print("Username Or Password Incorrect!")
  285.             home1()
  286.     except IOError:
  287.         print("Username Or Password Incorrect!")
  288.         home1()
  289. def create():
  290.     if acccreation==("true"):
  291.         username=input("Username: ")
  292.         password=input("Password: ")
  293.         try:
  294.             f = open((username) + '.txt','r')
  295.             time.sleep(0.10)
  296.             f = f.readlines()
  297.             a = f[0]
  298.             b = ("-= Info =- \n")
  299.             time.sleep(0.10)
  300.             if a==b:
  301.                 print("Username Already Exists")
  302.             else:
  303.                 home1()
  304.         except IOError:
  305.             f = open((username) + '.txt','w+')
  306.             level="1"
  307.             f.write(("-= Info =- \n") + (username) + ("\n") + (password) + ("\n-= Levels =-\n") + (level))
  308.             f.close()
  309.             print(("Your Login Details Are:\nUsername: ") + (username) + ("\nPassword: ") + (password) + ("\nYou have 5 Seconds To Write These Down"))
  310.             time.sleep(5)
  311.             print ("             "*2000)
  312.             home1()
  313.     else:
  314.         print("Account creation disabled by config")
  315.         home1()
  316. # # # # # # # # #
  317. #    Home       #
  318. # # # # # # # # #
  319. def temphome():
  320.     home1()
  321. def home1():
  322.     home1=input("Would you like to 'Login' or 'Create' a new account?: ")
  323.     home1 = home1.lower()
  324.     if home1=="login":
  325.         login()
  326.     if home1=="create":
  327.         create()
  328.     if home1=="admin":
  329.         adminlogin()
  330.     if home1=="changelog":
  331.         changelog()
  332.     else:
  333.         start=input("Press Any Key To Return Home")
  334.         temphome()
  335. # # # # # # # #
  336. # Config      #
  337. # # # # # # # #
  338. def config():
  339. #    f = open('config.txt','w+')
  340. #    testsetting="true"
  341. #    f.write(("-= Config =- \ntest:") + (testsetting))
  342. #    f.close()
  343.     global debug
  344.     global admin
  345.     global acccreation
  346.     f = open('config.txt','r')
  347.     time.sleep(0.10)
  348.     f = f.readlines()
  349.     a = f[1]
  350.     b = (("debug=") + ("true"))
  351.     time.sleep(0.10)
  352.     if a==b:
  353.         debug=("true")
  354.     else:
  355.         debug=("false")
  356.     a = f[2]
  357.     b = (("admin=") + ("true"))
  358.     time.sleep(0.10)
  359.     if a==b:
  360.         admin=("true")
  361.     else:
  362.         admin=("false")
  363.     a = f[3]
  364.     b = (("account_creation=") + ("true"))
  365.     time.sleep(0.10)
  366.     if a==b:
  367.         acccreation=("true")
  368.     else:
  369.         acccreation=("false")
  370. # # # # # # # #
  371. # Main Centre #
  372. # # # # # # # #
  373. username=("one")
  374. print (("\n") * (5))
  375. print ("To View the Changelog Type 'changelog'")
  376. config()
  377. home1()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top