mfoland Posted October 7, 2008 Share Posted October 7, 2008 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 https://forums.phpfreaks.com/topic/127327-trying-to-define-user-levels-in-a-users-profile/ Share on other sites More sharing options...
timmah1 Posted October 7, 2008 Share Posted October 7, 2008 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 https://forums.phpfreaks.com/topic/127327-trying-to-define-user-levels-in-a-users-profile/#findComment-658674 Share on other sites More sharing options...
waynew Posted October 7, 2008 Share Posted October 7, 2008 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 https://forums.phpfreaks.com/topic/127327-trying-to-define-user-levels-in-a-users-profile/#findComment-658847 Share on other sites More sharing options...
mfoland Posted October 7, 2008 Author Share Posted October 7, 2008 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 https://forums.phpfreaks.com/topic/127327-trying-to-define-user-levels-in-a-users-profile/#findComment-659168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.