Jump to content

access to page for certain pages via mysql


gweilo

Recommended Posts

Hi guys so i want to make page acces to certain ranks.

So im thinking for something like this

    rank1 -> home.php, admins.php
    rank2 -> home.php
    rank3 -> home.php
    rank4 -> home.php

So the ranks are in a database with the page names. So now when someone logs in they will get a certain rank. So now i need to make a function that will check if the rank has access to this page.

$curPageName = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);

This will detect the current page that the logged in person is at now. But now how do i check if the $_SESSION['rank']; (rank1) has the access to get in page admins.php, and obviously to make $_SESSION['rank'];(rank2) redirect from the page admins.php

Could someone point me in the right direction? Do i select the ranks and page names from database then put it into a array?

Thanks.

Link to comment
Share on other sites

Too magical.

For each page where you care about this, call a function with an identifier for the page. I don't mean "home.php" or "admins.php". I mean like "home" or "admin" or whatever label you want. The function grabs the rank from the session and looks it up in the database. With a query. And reacts accordingly.

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.