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 8125495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:50:17+00:00 2026-06-06T06:50:17+00:00

I am developing a website that requires several user types. I have been able

  • 0

I am developing a website that requires several user types. I have been able to redirect the user types to different homages based on user roll/type after they login. However, I need to restrict the Admin portion of the site to just admin role types. I am storing a “1” or “2” into the database based on user type/role. I am using the “session_start” and “session_is_registered” to check the user information. What do I need to add to this code to restrict users with a role type of “1” from seeing the page.

session_start();
if(!session_is_registered(username)){
header('Location: ../admin/index.php');
}
  • 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-06-06T06:50:19+00:00Added an answer on June 6, 2026 at 6:50 am

    Store the users role in a session variable

    $_SESSION["role"]=1;
    

    or

    $_SESSION["role"]=2; 
    

    depending on the stored user information.

    Then when you check the permissions, you just check this variable:

    if($_SESSION["role"]==2){
      header('Location: ../admin/index.php');
    } else {
      echo "you need the admin role to view this page!";
    }
    

    Another advice:
    It would be better to check the permissions in ../admin/index.php and redirect back to the default page if the user does not have the admin role. Otherwise users might be able to directly browse to ../admin/index.php if they know the URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a website that requires tagging up different types of content, which
I've been tasked with developing a website that requires a subscription fee to access
I'm developing a website that will be available in different languages. It is a
I am developing a .NET 3.5 Web Forms based website that uses URL Routing.
I have been developing a login library for a website using CodeIgniter. The authentication
I am developing a website that uses a lot of jQuery and I have
I'm currently developing a website on Wordpress that requires sort of like a fluid
I'm developing a web application that requires the user to log in using forms
On a website I'm developing, using Node, Express, and Backbone, I have the user
I'm developing a website that will host some videos. The client wants control over

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.