Student Listing: Adding User Logins - Access Authorization (with Session Variables)
Modifying Authorization Script to Check Access Privileges
Currently our authorizeaccess.php
script is using HTTP authentication to control access to scripts we protect with authorizeaccess.php
. If a user is not authorized to access the protected page, we will redirect them to an unauthorizedaccess.php
script. We need to add two conditions to achieve this:
- Prevent access to users not logged in
- Prevent access to users without administrative privileges AND NOT editing their own student details
If any of these conditions are true, we send the user to the unauthorizedaccess.php
script.
If the first condition is false, we can assume the user is logged in
If the second condition is false, it's because the user does not have admininstrative privileges and they're not editing their own details
Overwrite the current contents of the authorizeaccess.php
script with the following code:
authorizeaccess.php
- Student Listing: Complete Code Listing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|