hello masters, I have a problem regarding limiting the pages a certain user can access..in my case, i have added a roleID to my members table...
here is the original code first

<h1>Welcome SICS Admin!</h1>
<ul id='adminmenu'>
    <li><a href='index.php'>Modify News Archive</a></li>
    <li><a href='categories.php'>Categories</a></li>
    <li><a href='users.php'>Faculty</a></li>
    <li><a href="../" target="_blank">Department Website</a></li>
    <li><a href='logout.php'>Logout</a></li>
</ul>
<div class='clear'></div>
<hr />

then I went on and made it like this but it doesnt seem to work..I'm a novice in Php so bare with me please..i wanted to remove the Faculty tab for a user whose roleID=2.....

<?php
require_once('../includes/config.php');
if ($row['roleID'] = 1) {
    echo"<h1>Welcome SICS Admin!</h1>
<ul id='adminmenu'>
    <li><a href='index.php'>Modify News Archive</a></li>
    <li><a href='categories.php'>Categories</a></li>
    <li><a href='users.php'>Faculty</a></li>
    <li><a href='./simpleblog/viewpost.php'>Department Website</a></li>
    <li><a href='logout.php'>Logout</a></li>
</ul>
<div class='clear'></div>
<hr />";
}

elseif ($row['roleID'] = 2) {
echo"<h1>Welcome SICS Faculty!</h1>
<ul id='adminmenu'>
    <li><a href='index.php'>Modify News Archive</a></li>
    <li><a href='categories.php'>Categories</a></li>
    <li><a href='./simpleblog/viewpost.php'>Department Website</a></li>
    <li><a href='logout.php'>Logout</a></li>
</ul>
<div class='clear'></div>
<hr />";
}


?>

hey. post your $row query

oh yea right.forgot.but dude i have a problem look..

<?php
$query = "SELECT roleID FROM blog_members where roleID="roleID of the currently logged in user";
if ($row['roleID'] = 1) {
    echo"<h1>Welcome SICS Admin!</h1>
<ul id='adminmenu'>
    <li><a href='index.php'>Modify News Archive</a></li>
    <li><a href='categories.php'>Categories</a></li>
    <li><a href='users.php'>Faculty</a></li>
    <li><a href='./simpleblog/viewpost.php'>Department Website</a></li>
    <li><a href='logout.php'>Logout</a></li>
</ul>
<div class='clear'></div>
<hr />";
}
elseif ($row['roleID'] = 2) {
    echo"<h1>Welcome SICS Faculty!</h1>
<ul id='adminmenu'>
    <li><a href='index.php'>Modify News Archive</a></li>
    <li><a href='categories.php'>Categories</a></li>
    <li><a href='./simpleblog/viewpost.php'>Department Website</a></li>
    <li><a href='logout.php'>Logout</a></li>
</ul>
<div class='clear'></div>
<hr />";
}

are you using any session variable for : roleID of the currently logged in user in select query.

i think not....i just added roleid to my members table and was hoping to remove faculty tab when roleid of the logged in user is '2'...

then use This select Query.

$query = "SELECT roleID FROM blog_members where roleID='2'";

i take back what I just said..lol..clearly Im lost...let us put it in this way how about a query that selects the roleid of the currently logged in user?...

When the user is logged in then set its user id in session variable.

you are assigning a number when you use = only. try Using == iN yOUr if statement not = like $row['roleID'] == 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.