Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import string
- import random
- import sys
- import os
- # # # # # # #
- # Functions #
- # # # # # # #
- def levels():
- loggedin()
- def generator():
- import string
- import random
- import time
- possibleCharacters = string.ascii_lowercase + string.digits + string.ascii_uppercase + ' .,!?;:'
- target = input("Enter your target text: ")
- attemptThis = ''.join(random.choice(possibleCharacters) for i in range(len(target)))
- attemptNext = ''
- completed = False
- generation = 0
- while completed == False:
- print(attemptThis)
- attemptNext = ''
- completed = True
- for i in range(len(target)):
- if attemptThis[i] != target[i]:
- completed = False
- attemptNext += random.choice(possibleCharacters)
- else:
- attemptNext += target[i]
- generation += 1
- attemptThis = attemptNext
- time.sleep(0.02)
- print("Target matched! That took " + str(generation) + " generation(s)")
- end=input("Type 1 to run again or 0 To Return home: ")
- if end=="0":
- loggedin()
- else:
- generator()
- def calc():
- print("Welcome to the calculator")
- print("0.Return Home")
- print("1.Add")
- print("2.Subtract")
- print("3.Mutiply")
- print("4.Divide")
- main=input("Choice: ")
- if main=="0":
- loggedin()
- if main=="1":
- one=input("One: ")
- two=input("Two: ")
- total= float(one) + float(two)
- print(total)
- close=input("Press Enter To Continue")
- calc()
- if main=="2":
- one=input("One: ")
- two=input("Two: ")
- total= float(one) - float(two)
- print(total)
- close=input("Press Enter To Continue")
- calc()
- if main=="3":
- one=input("One: ")
- two=input("Two: ")
- total= float(one) * float(two)
- print(total)
- close=input("Press Enter To Continue")
- calc()
- if main=="4":
- one=input("One: ")
- two=input("Two: ")
- total= float(one) / float(two)
- print(total)
- close=input("Press Enter To Continue")
- calc()
- else:
- calc()
- # # # # # # #
- # User Area #
- # # # # # # #
- def loggedin():
- time.sleep(1)
- print (" "*2000)
- print("Options are listed below type one of them in to continue")
- print("0.Logout")
- print("1.Change Your Password")
- print("2.Use A Calculator")
- print("3.Text Generator")
- print("4.Levels")
- main=input("Choice: ")
- if main=="0":
- home1()
- if main=="1":
- password()
- if main=="2":
- calc()
- if main=="3":
- generator()
- if main=="4":
- levels()
- else:
- loggedin()
- # # # # # # # # #
- # Admin #
- # # # # # # # # #
- def adminlogin():
- print("Admin Control Panel")
- username=input("Username: ")
- password=input("Password: ")
- if username=="dan":
- if password=="dan":
- print("Logged In")
- print(" "*2000)
- adminhome()
- else:
- print("Login Failed, Returning Home")
- home1()
- else:
- print("Login Failed, Returning Home")
- home1()
- def tempadminhome():
- adminhome()
- def adminhome():
- print("Options are listed below type one of them in to continue")
- print("0.Logout")
- print("1.Change a users login details")
- print("2.Delete a user from the system")
- main=input("Choice: ")
- if main=="1":
- adminpassword()
- if main=="2":
- deleteuser()
- if main=="0":
- home1()
- else:
- tempadminhome()
- def deleteuser():
- print("Please enter the username of the user to delete enter '1' to return home")
- user=input("Username: ")
- if user=="1":
- print("\n")
- adminhome()
- else:
- try:
- os.remove((user) + (".txt"))
- print((user) + (" Removed from the system returning Home\n"))
- adminhome()
- except IOError:
- print("User Doesn't exist in the system, Returning Home\n")
- adminhome()
- def adminpassword():
- print("Enter the users username and desired password, If the user doesn't exist one will be created")
- username=input("Username: ")
- password=input("Password: ")
- f = open((username) + '.txt','w+')
- f.write(("-= Info =- \n") + (username) + ("\n") + (password))
- f.close()
- adminhome()
- # # # # # # # # #
- # AUTH #
- # # # # # # # # #
- def returnpasssword():
- password()
- def password():
- print("Please Relogin before chaning your password, type '1' to return home")
- username=input("Username: ")
- time.sleep(0.10)
- if username=="1":
- loggedin()
- else:
- password=input("Password: ")
- try:
- f = open((username) + '.txt','r')
- f = f.readlines()
- a = f[1]
- b = ((username) + ("\n"))
- time.sleep(0.10)
- if a==b:
- a = f[2]
- b = (password)
- time.sleep(0.10)
- if a==b:
- time.sleep(0.10)
- print("Please enter your new password")
- newpassword=input("Password: ")
- f = open((username) + '.txt','w+')
- f.write(("-= Info =- \n") + (username) + ("\n") + (newpassword))
- f.close()
- print(("Your new details are the following:\n") + ("Username: ") + (username) + ("\nPassword: ") + (newpassword))
- time.sleep(2)
- loggedin()
- else:
- print("Username Or Password Incorrect!")
- returnpasssword()
- else:
- print("Username Or Password Incorrect!")
- returnpasssword()
- except IOError:
- print("Username Or Password Incorrect!")
- returnpasssword()
- def login():
- username=input("Username: ")
- time.sleep(0.10)
- password=input("Password: ")
- try:
- f = open((username) + '.txt','r')
- f = f.readlines()
- a = f[1]
- b = ((username) + ("\n"))
- time.sleep(0.10)
- if a==b:
- a = f[2]
- b = (password)
- time.sleep(0.10)
- if a==b:
- time.sleep(0.10)
- print("Logged in")
- print("Sending you to Home")
- time.sleep(0.25)
- loggedin()
- else:
- print("Username Or Password Incorrect!")
- home1()
- else:
- print("Username Or Password Incorrect!")
- home1()
- except IOError:
- print("Username Or Password Incorrect!")
- home1()
- def create():
- username=input("Username: ")
- password=input("Password: ")
- try:
- f = open((username) + '.txt','r')
- time.sleep(0.10)
- f = f.readlines()
- a = f[0]
- b = ("-= Info =- \n")
- time.sleep(0.10)
- if a==b:
- print("Username Already Exists")
- else:
- home1()
- except IOError:
- f = open((username) + '.txt','w+')
- f.write(("-= Info =- \n") + (username) + ("\n") + (password))
- f.close()
- print(("Your Login Details Are:\nUsername: ") + (username) + ("\nPassword: ") + (password) + ("\nYou have 5 Seconds To Write These Down"))
- time.sleep(5)
- print (" "*2000)
- home1()
- # # # # # # # # #
- # Home #
- # # # # # # # # #
- def temphome():
- home1()
- def home1():
- home1=input("Would you like to 'Login' or 'Create' a new account?: ")
- home1 = home1.lower()
- if home1=="login":
- login()
- if home1=="create":
- create()
- if home1=="admin":
- adminlogin()
- else:
- start=input("Press Any Key To Return Home")
- temphome()
- # # # # # # # #
- # Main Centre #
- # # # # # # # #
- home1()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement