Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6589943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:14:17+00:00 2026-05-25T17:14:17+00:00

I already have an existing login system using php and mysql using sessions. I

  • 0

I already have an existing login system using php and mysql using sessions. I think i do not need to post the code here.

i want to add a user level feature to it, wherein it limits the pages that can be viewed by a registered user depending on his access level. Example user level 1 can can access pages 1-5 only, and user level 2 can access pages 1-10, and so on.

i addedd a userlevel column on my members table. and i do not know what is the next step.

what particular function / code can be used to set the user level restrictions on the pages?

i tried searching out for examples in the web but can’t find any good one.

please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:14:18+00:00Added an answer on May 25, 2026 at 5:14 pm

    You haven’t given me much information as to what’s happening (Maybe that’s why your username is PHPNewbie).

    What I did have done with a previous user system of mine is I had a separate table called groups. In the groups table it had boolean values of different privileges in columns (such as canComment). Whenever I needed to verify if a user could perform an action, I just checked for a true value in action’s column.

    You could implement this by having a broader user system, where an integer userLevel could indicate the group of the user (0 – root, 1 – basic etc.). What it appears you want is a page restriction system. I can suggest you use a switch statement that retrieves the userLevel as so –

    switch(userLevel) { //Where userLevel is an int retrieved from the session/database
    case 0:
        echo $page;
    break;
    
    case 1:
        echo "You cannot access this resource...";
    break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing, non-framework-based PHP/MySQL website. It has a simple security model, with
I have an already existing stored procedure. But when I am trying to create
I have defined a new dialog and its controls in an already existing resource
I'm having a bit of trouble loading pages into an already-existing colorbox. I have
I already have code which lazy loads scripts on request. My issue now is
I already have Java code to display and process data from a database. I
I need to implement facebook-connect to a website where users already might have their
I have an existing website using forms authentication with Sql provider. Now i am
I have an existing website using forms authentication with Sql provider. Now i am
I'm using Entity Framework 4.1 Code First. In my entity, I have three date/time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.