Question: Write a PHP function checkPass that takes two arguments: $user and $password and returns the UserID if the password matches the MD5 encoding of the

Write a PHP function "checkPass" that takes two arguments: $user and $password and returns the UserID if the password matches the MD5 encoding of the appropriate password in the interview_user_info table below and -1 otherwise.

The $user variable contains the NetID of the individual; the $password variable contains a clear-text version of the password as submitted.

+---------------------------------------------------------------------------------+ | interview_user_info | +-----------+-------------+-----------+--------+----------------------------------+ | UserID | LastName | FirstName | NetID | Passwd | +-----------+-------------+-----------+--------+----------------------------------+ | 469562029 | Gonzalez | Shauntee | sgonz | 530b4a0ae65148d112537bc0eafba9c9 | | 702930431 | Bates | Austin | abates | 9cdfb439c7876e703e307864c9167a15 | +-----------+-------------+-----------+--------+----------------------------------+ 

The connection and database selection are taken care of. Write the query to pull data from the table "interview_user_info", and return the result. The connection will be closed for you.

Hint: You will likely need to make use of the following functions and possibly others: md5, mysql_query, mysql_fetch_assoc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!