gweilo Posted June 9, 2020 Share Posted June 9, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310908-access-to-page-for-certain-pages-via-mysql/ Share on other sites More sharing options...
requinix Posted June 9, 2020 Share Posted June 9, 2020 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. Quote Link to comment https://forums.phpfreaks.com/topic/310908-access-to-page-for-certain-pages-via-mysql/#findComment-1578774 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.