Forum Moderators: coopster
I have a login page and user homepages if looged in. Now I want to check ifthe user has privilage to view that perticualr page. <br>
For Example.
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">Dept</th>
<th scope="col">hompage</th>
</tr>
<tr>
<td>IT</td>
<td>IT.php </td>
</tr>
<tr>
<td>HR</td>
<td>HR.php</td>
</tr>
<tr>
<td>Accounts</td>
<td>Acc.php</td>
</tr>
</table>
Now if the IT people tries to enter the HR page then it shlould give an error message
Any help would be appreciated.
Warm regards
2. If it's a normal restriction page, then you can setup a DB table priviledges, where you store info what kind of priviledges to what page user has.
3. Or you can setup a hierarchic system - one variable state, where you store number, the higher number, the more user can.
I think the first and second are best options for you. Or combination of 1. and 3.
It all depends what you like to have.
bbforums have the 2. option installed.
Hope this herlps you
Michal
Now the client login and i check the deptid for that login and store his deptid on a session variable and redirect him to his previalged page.
My question is, suppose if the logged in users tries to enter the url whose previalges page is not as his privalged, i have to throw him a message. Please let me know if iam quite clear.
Example; userid = Saint
deptid = 1
access page = 1.php
userid = Honore
deptid = 2
access page = 2.php
if userid = Saint -----> throw message
Do you have user level and dept level access?
I think you are probably looking to set the access group for the section or page
so you would need to set the level for the page/section and then copare with the level stored in the session
$pageaccess = 2;
if ($_SESSION['deptid']!= 2) {
echo '<p>You aren't allowed here';
die();
}
if you had progressive levels you could also use a comparison like
if ($_SESSION['deptid'] < 2) {
then if you needed user specific tests then that could be done as well. User specific tests/access are usually reserved for single or high level users as they become more work for large groups of users.