Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- names = {}
- emails= []
- def first():
- f = file('user','w')
- print "This is your first time. This account will be made administrator."
- a = raw_input ("Enter your desired username : ")
- b = raw_input ("Enter your desired password : ")
- global a
- global b
- f.write(a+','+b)
- names[a]=b
- f.close()
- def load():
- f = file('user','r')
- for line in f:
- list2 = line.split(',')
- names[list2[0]]=list2[1]
- f.close()
- def emailadd():
- f = file(existuser,'w')
- emailadd = raw_input("Enter your email: ")
- emails.append(emailadd)
- f.write(emailadd)
- f.close()
- def normal():
- while True:
- menuchoice = raw_input("Press e to add your email, v to view your current email and q to logout : ")
- if menuchoice == "e":
- emailadd()
- if menuchoice == "v":
- try:
- f = file(existuser,'r')
- for lines in f:
- print lines
- except IOError:
- print "You have no email yet, press e to add one"
- if menuchoice =="q":
- break
- def create():
- f = file("user","a")
- newuser = raw_input ("Enter your desired username: ")
- newpass = raw_input ("Enter your desired password: ")
- names[newuser]=newpass
- f.write('\n'+ newuser+','+newpass)
- print names
- f.close()
- def admin():
- f = file('user','w')
- while True:
- deletepeople = raw_input ("Press d to delete someone and v to look at the names \nPress q to log out.:")
- if deletepeople == "d":
- deletereal = raw_input("Who would you like to delete? :")
- del names[deletereal]
- print "Sucessfully deleted"
- if deletepeople == "v":
- print names
- if deletepeople == "q":
- break
- f.close()
- try:
- load()
- except:
- first()
- load()
- while True:
- f = file("user",'r')
- print "Welcome to Xerotics competition's login system."
- decide = raw_input("Please choose what you want to do. \n1)Create new user :\n2)Login to existing user :\n 1/2:")
- print names
- if decide == '1':
- create()
- if decide == '2':
- existuser = raw_input ("Enter your username :")
- existpass = raw_input ("Enter your password :")
- if existpass in names[existuser]:
- print "Congratulations, you have logged in."
- global existuser
- f.close()
- if existuser == a and existpass == b:
- admin()
- else:
- normal()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement