Jump to content

User Levels


dean7

Recommended Posts

Hi all on my website i have a mod panel witch only staff can see it (mod admin etc..) how could i code somthing so only the staff can see the link and access that page but users carnt? But if users try going to that url it move them to a different page?

 

Thanks for you help :)

Link to comment
Share on other sites

in my database i have user lvl in the users table witch has lvls like owner But when i change

 

<?php
if($row['level']== owner {
?>

 

It doesnt show the link to the users who have the user lvl owner

 

 

This is what im trying.

 

<?php
if($row['level'] == owner){
?>
- <a href="../admin/index.php" target="mainFrame">Admin</a><br>
<?php
}
?>

 

but that dont show the link after

Link to comment
Share on other sites

<div class="menutitle" onclick="SwitchMenu('sub1')">Staff Panel</div>
<span class="submenu" id="sub1">
	<?php
if($row['level'] == "owner"){
?>
- <a href="../admin/index.php" target="mainFrame">Admin</a><br>
<?php
}
?>

 

That is basicly the script. Its part of my menu.

Link to comment
Share on other sites

My code is now

 

<div class="menutitle" onclick="SwitchMenu('sub1')">Staff Panel</div>
<span class="submenu" id="sub1">
	<?php
var_dump($row['level'] == "owner"){ // line 132
?>
- <a href="../admin/index.php" target="mainFrame">Admin</a><br>
<?php
}
?>

 

But its now saying

Parse error: syntax error, unexpected '{' in /home/a7502957/public_html/nav.php on line 132

Link to comment
Share on other sites

<div class="menutitle" onclick="SwitchMenu('sub1')">Staff Panel</div>
<span class="submenu" id="sub1">
	<?php
var_dump($row['level']);
if($row['level' == "owner"){ // line 132
?>
- <a href="../admin/index.php" target="mainFrame">Admin</a><br>
<?php
}
?>

 

Try it like that

 

Link to comment
Share on other sites

Doing that makes an error

 

Parse error: syntax error, unexpected ')', expecting ']' in /home/a7502957/public_html/nav.php on line 133

 

My code

 

<div class="menutitle" onclick="SwitchMenu('sub1')">Staff Panel</div>
<span class="submenu" id="sub1">
<?php
var_dump($row['level']);
if($row['level' == "owner"){ // line 133
?>
- <a href="../admin/index.php" target="mainFrame">Admin</a><br>
<?php
}
?>

Link to comment
Share on other sites

Do you have a connection to the database in that code?

Do you have it connecting to the table level is in?

Do you have a level named owner?

Yeah i have a connection to the database in the code

I have the lvl called owner

But what you mean by have it connecting to the table level is in?

Link to comment
Share on other sites

I do it while the user submits his log in data so

 

index.php - > check.php ( check.php sets all my sessions and checks the database for the proper username and password if username and password = true meaning it is correct then sends to profile.php which then if the sessions are correct for the user to have admin rights 3 being admin 2 being mod 1 being  no admin/mod rights just regular member if it is 3 then it displays admin if it is 2 it displays mod if 3 it displays nothing. pretty simple way of doing it. if I was at home or had my scp connection i would give you my script for you to use.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.