Jump to content

Trying to define User Levels in a users profile


mfoland

Recommended Posts

Hello,

 

This is my first time on this forum, and I tried contacting someone in IRC.

 

I am building a school closing system. I am setting up a profile system and use User Levels. I have 17 levels, well 18 if you would count level 0. The levels echo just like this: <?= $userlevel;?> and generates the user level number...

 

However in the profile I want it to be like this:

User Level: 10 - Administration

etc, etc.

 

How do I define the user levels?

 

Thanks

 

Mike

Link to comment
Share on other sites

Are these held in a database or with sessions?

 

When the user logs in, you can easily create a session with their level based upon their login information

 

Then you could echo out the level

<?php
session_start();

if($_SESSION['SESS_LEVEL'] == 10){
$level = Administration;
}
echo $level;
?>

 

This could at least get you started

Link to comment
Share on other sites

You could use an array to keep track of what each level is:

 

$level_config[1] = "Student";
$level_config[2] = "Administrator";

 

Then:

 

$level = $_SESSION['user_level'];
echo $level_config[$level];

 

I also suggest that when these users are carrying out level-specific actions, that you check the database first before allowing them.

Link to comment
Share on other sites

Hey guys,

 

I got what I needed.. It goes through a database. I had someone from the mIRC chat to help..

 

My next project is making sperate offices and they show up in the office list if they are registered..

 

In the user profile it will looks like this:

 

Districts user is listed in:

 

Sample District 1 - Level 5

Sample 2 - Level 0

etc...

 

If they are level 8 on the main user level and I add them into my Admin Area (National Headquarters),

and want to assign a level for them so they can do certain things... be like

National Headquarters - Level 2

 

If they have National Headquarters - Level 0 and it show up in the office list, have it say Unauthorized acces to this page.

 

IM me on yahoo... quistifa

 

Thanks,

Mike

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.