Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def loginstart():
- print("Welcome To The Login!")
- p = open("password.txt","r")
- actualpassword = p.read()
- p.close()
- u = open("username.txt","r")
- actualusername = u.read()
- u.close()
- if actualusername == "" or actualpassword == "":
- print("We Have Detected That You Have Not Set Any Login Details.")
- newlogin()
- else:
- loginmatch()
- #---------------------------------------------------
- def newlogin():
- passwordfile = open("password.txt","w")
- passwordfile.write("")
- passwordfile.close
- usernamefile = open("username.txt","w")
- usernamefile.write("")
- usernamefile.close
- usernameentry = input("Please Enter A New Username: ")
- passwordentry = input("Please Enter A New Password: ")
- print("Please restart the program in order to login.")
- passwordfile = open("password.txt","w")
- passwordfile.write(passwordentry)
- passwordfile.close
- usernamefile = open("username.txt","w")
- usernamefile.write(usernameentry)
- usernamefile.close
- #-------------------------------------------------------
- def loginmatch():
- p = open("password.txt","r")
- actualpassword = p.read()
- p.close()
- u = open("username.txt","r")
- actualusername = u.read()
- u.close()
- ihopethisworks = True
- while ihopethisworks == True:
- userusername = input("Enter Username Here: ")
- userpass = input("Enter Password Here: ")
- if userusername != actualusername:
- print("Incorrect Username.")
- ihopethisworks = True
- if userpass != actualpassword:
- print ("Incorrect Password.")
- ihopethisworks = True
- if userpass == actualpassword and userusername == actualusername:
- print ("Login Details Accepted.")
- ihopethisworks = False
- menusystem()
- #-----------------------------------------------------------------------------------
- def menusystem():
- menurepeat = True
- while menurepeat == True:
- print("Welcome To The Menu System!")
- print("Where would you like to go?")
- print("Enter '1' to go to the Student Information Section.")
- print("Enter '2' to go to the Report Menu Section.")
- print("Enter '3' to go to change your login details.")
- print("Enter '4' to logout.")
- menuinput = input("Enter Here: ")
- if menuinput == "1":
- studentsinformation()
- menurepeat = False
- elif menuinput == "2":
- reportmenu()
- menurepeat = False
- elif menuinput == "3":
- print("Please confirm your current login details.")
- logincheck()
- menurepeat = False
- elif menuinput == "4":
- print("You have logged out and are being returned to the login!")
- loginstart()
- menurepeat = False
- #------------------------------------------------------------------------------------
- def logincheck():
- p = open("password.txt","r")
- actualpassword = p.read()
- p.close()
- u = open("username.txt","r")
- actualusername = u.read()
- u.close()
- ihopethisworks = True
- while ihopethisworks == True:
- userusername = input("Enter Username Here: ")
- userpass = input("Enter Password Here: ")
- if userusername != actualusername:
- print("Incorrect Username.")
- ihopethisworks = True
- if userpass != actualpassword:
- print ("Incorrect Password.")
- ihopethisworks = True
- if userpass == actualpassword and userusername == actualusername:
- print ("Login Details Accepted.")
- ihopethisworks = False
- newlogin()
- def studentsinformation():
- studentinforepeat = True
- while studentinforepeat == True:
- print("Welcome to the Student Information Section.")
- print("Enter '1' to Enter New Students Information.")
- print("Enter '2' to Read Student Information.")
- print("Enter '3' to Go Back.")
- studentinfoinput = input("Enter Here: ")
- if studentinfoinput == "1":
- enterstudents()
- studentinforepeat = False
- elif studentinfoinput == "2":
- studentidretrieve()
- studentinforepeat = False
- elif studentinfoinput == "3":
- menusystem()
- def enterstudents():
- studentID = input("Please enter the students ID: ")
- studentforename = input("Please enter the students forename: ")
- studentsurname = input("Please enter the students surname: ")
- studentdob = input("Please enter the students date of birth: ")
- studentaddress = input("Please enter the students address: ")
- studentphonenumber = input("Please enter the students home phone number: ")
- studentgender = input("Please enter the students gender: ")
- studenttutorgroup = input("Please enter the students tutor group: ")
- studentemail = input("Please enter the students email address: ")
- studentfilename = studentID + " information.txt"
- es = open(studentfilename, "w+")
- es.write("Student ID: ")
- es.write(studentID)
- es.write("\n")
- es.write("Forename: ")
- es.write(studentforename)
- es.write("\n")
- es.write("Surname: ")
- es.write(studentsurname)
- es.write("\n")
- es.write("Date of Birth: ")
- es.write(studentdob)
- es.write("\n")
- es.write("Address: ")
- es.write(studentaddress)
- es.write("\n")
- es.write("Phone Number: ")
- es.write(studentphonenumber)
- es.write("\n")
- es.write("Gender: ")
- es.write(studentgender)
- es.write("\n")
- es.write("Tutor Group: ")
- es.write(studenttutorgroup)
- es.write("\n")
- es.write("Email: ")
- es.write(studentemail)
- es.close()
- print("Successfully entered student information.")
- studentsinformation()
- def logout():
- print("Welcome to the logout function!")
- def studentidretrieve():
- studentidretrieve = input("Please input the students ID.")
- studentfilenameretrieve = studentidretrieve + " information.txt"
- esr = open(studentfilenameretrieve,'r')
- studentinfo = esr.read()
- print(studentinfo)
- esr.close()
- def reportmenu():
- print("Welcome to the report menu function!")
- def report1():
- print("Welcome to report 1!")
- def report2():
- print("Welcome to report 2!")
- def report3():
- print("Welcome to report 3!")
- #----------------------------------------------------------------------------------
- loginstart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement