Lab 3: Databased Admin Tool Python
Objective: Develop an admin tool for username and password management. You will need to use the best data structure to store the data you read from UD.txt for efficient processing. You can accomplish these tasks with Dictionary or List.
The data file (UD.txt) :
FIRST NAME, LAST NAME,USERNAME,PASSWORD
Sam, DDal,sdd233,Pad231
Dave,Dcon,dcf987, BHYW4fw
Dell,Grant,dgr803,Sb83d2d
Mike,Kress,mkr212,UNNHS322
Lisa,Kate,lki065,dgw6234
Paul,Edward,ped332,9891ds
Youyou,Tranten,ytr876,dsid21kk
Nomi,Mhanken,nmh223,3282jd3d2
Write a program that imports the database from UD.txt
Give the following options:
A: Search by last name
B: Search by first name
C: Search by username
D: Display all users alphabetically by First name
E. Display all users alphabetically by Last name
F: Insert a user
If the user is found, display the user’s info. For example: Sam, DDal,sdd233,Pad231
If user not found, display “Not found”, and return the user to main menu
If the user is found, display the user’s info. For example: Sam, DDal,sdd233,Pad231
If user not found, display “Not found”, and return the user to main menu
If the user is found, display the user’s info. For example: Sam, DDal,sdd233,Pad231
If user not found, display “Not found”, and return the user to main menu
Important: Declare one function called “def output ()” to output information for option D and E.
source code:
#Please go through comments and modify if any thing required thank you
#screenshots provided for indentation and reference purposes
#output function for D and E options
#prints the list if provided
def output(data):
print('{0: <20}{1: <20}{2: <20}{3: <20}'.format("FIRST
NAME","LAST NAME","USERNAME","PASSWORD"))
for ml in data:
print('{0: <20}{1: <20}{2: <20}{3:
<20}'.format(ml[0],ml[1],ml[2],ml[3]))
#main function
def main():
file=open("UD.txt","r") #text file opening
ml=list()
i=0
for line in file: #reading line by line and listing all contents as
each list
if i!=0:
ll=line.split(",")
ml.append(ll)
i=1
file.close() #closed text file
print("Select from following options:\n") #user given with
options
print("A: Search by last name\nB: Search by first name\nC: Search
by username\nD: Display all users alphabetically by First name\nE.
Display all users alphabetically by Last name\nF: Insert a
user\n")
ch=input("Q for quit.")
while(True):
if ch=='Q':#quits
break;
elif ch=='A':#searches content using last name
name=input("Enter last name to Search: ")
i=0
j=0
for ll in ml:
if ll[1]==name:
i=j
break;
j=j+1
if i==0:
print("Not Found")
else:
print('{0: <20}{1: <20}{2: <20}{3:
<20}'.format(ml[i][0],ml[i][1],ml[i][2],ml[i][3]))
elif ch=='B':#searches name using first name
name=input("Enter first name to Search: ")
i=0
j=0
for ll in ml:
if ll[0]==name:
i=j
break;
j=j+1
if i==0:
print("Not Found")
else:
print('{0: <20}{1: <20}{2: <20}{3:
<20}'.format(ml[i][0],ml[i][1],ml[i][2],ml[i][3]))
elif ch=='C':#searches using usrname
name=input("Enter username to Search: ")
i=0
j=0
for ll in ml:
if ll[2]==name:
i=j
break;
j=j+1
if i==0:
print("Not Found")
else:
print('{0: <20}{1: <20}{2: <20}{3:
<20}'.format(ml[i][0],ml[i][1],ml[i][2],ml[i][3]))
elif ch=='D':#sorts the data using first name
rl=ml
rl.sort(key=lambda x:x[0])
output(rl)
elif ch=='E':#sorts data using last name
rl=ml
rl.sort(key=lambda x:x[1])
output(rl)
elif ch=='F':#writest to text file
det=input("Enter user info in the following format: First name,
last name, username, password:")
file=open("UD.txt","a")
file.write("\n")
file.write(det)
file.close
print("Select from following options:\n")
print("A: Search by last name\nB: Search by first name\nC: Search
by username\nD: Display all users alphabetically by First name\nE.
Display all users alphabetically by Last name\nF: Insert a
user\n")
ch=input("Q for quit.")
if __name__ == '__main__':
main()
Lab 3: Databased Admin Tool Python Objective: Develop an admin tool for username and password management. You will need...
Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....
In C , checks if the entered password for admin is correct by calling checkAdminPassword. Part of this function has been implemented, complete the statement in if(). Keep in mind that the entered password is plaintext whereas the password in struct user is in the hashsed form. The password for user admin is “s#1Pa5”. int checkAdminPassword(char* password, struct user* users, int count) { for (int i = 0; i < count; ++i) { if (strcmp((users + i)->username, "admin") == 0)...
Lab Assignment – Database Implementation and Security In this lab you will create a Microsoft Access database of employee information and secure the table username and password security. Steps Enter data for five employee records. Each record should have fields: Employee ID (5 digits), First Name, Last Name, Home Address, Hire Date Create a query that displays Employee ID, First Name and Last Name. Create a form that requires entering username and password to access employee table. Error message should...
Using Python INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...
Lab Assignment – Database Implementation and Security In this lab you will create a Microsoft Access database of employee information and secure the table username and password security. Steps Enter data for five employee records. Each record should have fields: Employee ID (5 digits), First Name, Last Name, Home Address, Hire Date Create a query that displays Employee ID, First Name and Last Name. Create a form that requires entering username and password to access employee table. Error message should...
Inventory ManagementObjectives:Use inheritance to create base and child classesUtilize multiple classes in the same programPerform standard input validationImplement a solution that uses polymorphismProblem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes...
Problem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes re-ordering the menu items and making changes to the description of a menu item without having to change the code.Security:The company has...
Using MySQL and PHP keep it simple This assignment you will be making a form that will do one of three things in a database - It will add a record - It will update a record - It will search for a record Your database will contain a table for keeping a record of all your friends and family and should contain: First name Last name Phone number Address City State Zip Birthdate Username Password The sex of the...