


How to implement different permissions to enter different pages in PHP
How to implement different permissions to enter different pages in PHP
First, when the user logs in successfully, add the user's permission level to the Session session ;
<?php $user_perm_level = 1; session_start(); $_SESSION['user_perm_level'] = $user_perm_level; ?>
Then when accessing the page, take out the permission level stored in the Session;
<?php session_start(); $user_perm_level = $_SESSION['user_perm_level']; ?>
Finally, jump to the corresponding page according to the permission level.
<?php session_start(); $user_perm_level = $_SESSION['user_perm_level']; switch($user_perm_level){ case 1: header("location: topage1.php"); break; case 2: header("location: topage2.php"); break; case 3: header("location: topage3.php"); break; default: header("location: topage.php"); break; } ?>
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of How to implement different permissions to enter different pages in PHP. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor
