[eluser]mdcode[/eluser]
I have a form that I need to restrict certain entries on. The users of the system have two access "codes", one for the state the user is located, and one for department they are in. I need to create some rule logic where I do not have to repeat the form code in the file but check conditions on each of the user settings. I also have a 'catch all' code of 0.
To try to make it clearer, this is the code as it stands:
Code:
if ($this->session->userdata('state') == $project->state_code || 0 && $this->session->userdata('dept') == $project->dept || 0) {
// Display the form
...
} else { echo "You do not have access!"; }
The conditions for being able to edit the project are:
The users state matches that of the project attempting to be edited
AND
The users department matches that of the project attempting to be edited
OR
Either the users state or department equals 0.
I appreciate any help on this as reading up elsewhere is not yielding any definitive answers.