Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sign Out Overview READ CAREFULLY: For this problem, The first function, getQuery, is used to query a table for a set of results. The second

image text in transcribed

image text in transcribed

Sign Out Overview READ CAREFULLY: For this problem, The first function, getQuery, is used to query a table for a set of results. The second function, checkPass. prod you will need to create two functions that will work in tandem. query a table for a set of results. The second tunction, checkPass, processes those results to see if a given unhashed password matches the hashed password in the database getQuery(0 string getQuery (string SnetId n should return a MySQL query string that will select rows from the interview user info table that match the given argument (SnetlD) You can return all the fields (") or just the ones you feel will be needed in the second function I interview user_info I UserID I LastName FirstName | NetID | Passwd 1 469562029 | Gonzalez Shauntee | sgonz 1 702930431 | Bates Imore data 530b4a0ae65148d112537bcBeafba9c9 I Austin abates | 9cdfb439c7876e783e307864c9167a15 checkPass() int checkPass string Spassword, array SqueryResults The second function will process the results that were returned from the query created by the first function. The arguments it will be passed will be an unhashed password (Spassword) and the results from your query string (SqueryResults) in the form of a 2-dimensional array. Keep in mind that the results are a 2-dimensional array, even if you just returned one result (which should be the case since there are no duplicate NetlDs in the table). The first dimension of the array is a zero-indexed numeric array. The second dimension is an associative array where the keys match the field 1 469562029 | Gonzalez C> Sign Out 702938431 | Bates more data I Shauntee 1 sgonz 1 530b4a8ac65148d112537bceeafba9c9 I I Austin I abates | 9cdfb439c7876e703e307864c9167a15 | checkPass) int checkPass C string $password, array SqueryResults The second function will process the results that were returned from the query creat unhashed password (Spassword) and ed by the first function. The arguments it will be passed will be an the results from your query string (SqueryResults) in the form of a 2-dimensional array. Keep in mind that the results are a ensional array, even if you just returned one result (which should be the case since there are no duplicate NetlDs in if you the table). The first dimension of the array is a zero-indexed numeric array. The second dimension is an associative array where the keys match th names of the table. So, for example, to access THIRD row of the array and the UserTD and Passwd fields of that row, you would do something like SthisUserID SqueryResults [2] [ 'UserID': $thisPasswd -squeryResults 121 I'Passwd'] Keep in mind that the Spassword argument is an unhashed password and the Passwd field in the database is hashed using MD5. You will need to use the md5 php function to compare the two values. If the password is correct, your function should return the associated UserlD (e.g. 246135987). If the password is incorrect, or if there is no matching record, you should return a -1 intege. Warning: If you var_dump or echo the SqueryResults argument (which you should try), you may notice a realpass field in the table. This is used for creating test cases for your functions. You MAY NOT use this field to do the actual check. You must check against the hashed Passwd field Sign Out Overview READ CAREFULLY: For this problem, The first function, getQuery, is used to query a table for a set of results. The second function, checkPass. prod you will need to create two functions that will work in tandem. query a table for a set of results. The second tunction, checkPass, processes those results to see if a given unhashed password matches the hashed password in the database getQuery(0 string getQuery (string SnetId n should return a MySQL query string that will select rows from the interview user info table that match the given argument (SnetlD) You can return all the fields (") or just the ones you feel will be needed in the second function I interview user_info I UserID I LastName FirstName | NetID | Passwd 1 469562029 | Gonzalez Shauntee | sgonz 1 702930431 | Bates Imore data 530b4a0ae65148d112537bcBeafba9c9 I Austin abates | 9cdfb439c7876e783e307864c9167a15 checkPass() int checkPass string Spassword, array SqueryResults The second function will process the results that were returned from the query created by the first function. The arguments it will be passed will be an unhashed password (Spassword) and the results from your query string (SqueryResults) in the form of a 2-dimensional array. Keep in mind that the results are a 2-dimensional array, even if you just returned one result (which should be the case since there are no duplicate NetlDs in the table). The first dimension of the array is a zero-indexed numeric array. The second dimension is an associative array where the keys match the field 1 469562029 | Gonzalez C> Sign Out 702938431 | Bates more data I Shauntee 1 sgonz 1 530b4a8ac65148d112537bceeafba9c9 I I Austin I abates | 9cdfb439c7876e703e307864c9167a15 | checkPass) int checkPass C string $password, array SqueryResults The second function will process the results that were returned from the query creat unhashed password (Spassword) and ed by the first function. The arguments it will be passed will be an the results from your query string (SqueryResults) in the form of a 2-dimensional array. Keep in mind that the results are a ensional array, even if you just returned one result (which should be the case since there are no duplicate NetlDs in if you the table). The first dimension of the array is a zero-indexed numeric array. The second dimension is an associative array where the keys match th names of the table. So, for example, to access THIRD row of the array and the UserTD and Passwd fields of that row, you would do something like SthisUserID SqueryResults [2] [ 'UserID': $thisPasswd -squeryResults 121 I'Passwd'] Keep in mind that the Spassword argument is an unhashed password and the Passwd field in the database is hashed using MD5. You will need to use the md5 php function to compare the two values. If the password is correct, your function should return the associated UserlD (e.g. 246135987). If the password is incorrect, or if there is no matching record, you should return a -1 intege. Warning: If you var_dump or echo the SqueryResults argument (which you should try), you may notice a realpass field in the table. This is used for creating test cases for your functions. You MAY NOT use this field to do the actual check. You must check against the hashed Passwd field

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

2. List your top 10 film villains.

Answered: 1 week ago

Question

Explain global human resource management.

Answered: 1 week ago

Question

Describe the grievance procedure in a union environment.

Answered: 1 week ago

Question

Discuss whistleblower protection under OSHA.

Answered: 1 week ago