php判断超级管理员,管理员,和用户的整段语句不会写

数据库里有三个信息,w是超级管理员,权限是2,
j是管理员,权限是1,x是普通用户,权限是0。
判断登录的是超级管理员、管理员、还是用户的php代码怎么写呀,在setting 页面判断,判断后不同身份的角色登录后还要跳转到不同的页面,得用到include,图片是详细要求。希望代码尽量普通或者简单一些,太复杂的看不太懂,谢谢

img

img

img

img

<?php

// Replace with your database server name, username, password, and database name
$servername = "";
$username = "";
$password = "";
$dbname = "";

// Create a connection to the database
$con = new mysqli($servername, $username, $password, $dbname);

// Check if the connection was successful
if ($con->connect_error) {
  die("Connection failed: " . $con->connect_error);
}

// Create the SQL query to create a table named "wjx1"
$sql = "CREATE TABLE wjx1 (
    id int(6) primary key,
    xuehao int(10),
    xingming varchar(30),
    password int(10),
    email varchar(30),
    denglucishu int(10),
    type int default '1'
)";

// Execute the query and check if it was successful
if ($con->query($sql) === true) {
  echo "Table wjx1 created successfully<br>";
} else {
  echo "Error creating table: " . $con->error . "<br>";
}

// Insert some data into the table
$sql = "INSERT INTO wjx1 (id, xuehao, xingming, password, email, denglucishu, type) VALUES (1, 2017, 'w', 2017, 'w00', 0, 2)";

// Execute the query and check if it was successful
if ($con->query($sql) === true) {
  echo "Data inserted successfully<br>";
} else {
  echo "Error inserting data: " . $con->error . "<br>";
}

// Insert more data into the table
$sql = "INSERT INTO wjx1 (id, xuehao, xingming, password, email, denglucishu, type) VALUES (2, 2018, 'j', 2018, 'w00', 0, 1)";

// Execute the query and check if it was successful
if ($con->query($sql) === true) {
  echo "Data inserted successfully<br>";
} else {
  echo "Error inserting data: " . $con->error . "<br>";
}

// Insert more data into the table
$sql = "INSERT INTO wjx1 (id, xuehao, xingming, password, email, denglucishu, type) VALUES (3, 2019, 'x', 2019, 'wjxo0', 0, 0)";

// Execute the query and check if it was successful
if ($con->query($sql) === true) {
  echo "Data inserted successfully<br>";
} else {
  echo "Error inserting data: " . $con->error . "<br>";
}

// Close the database connection
$con->close();

?>

public function setfun(){

$uid=I('get.id',0,'int');

$a=M('admin');

$user=$a->where(array(id=>$uid))->field('username,id')->find();

$this->username=$user['username'];

$this->userid=$user['id'];

$m=M('funcla');

$funcla=$m->where(array(clapid=>'0'))->field(true)->select();

$fun=$m->field(true)->select();

$this->fun=$fun;

$this->funcla=$funcla;

$fd=M('funadmin');

$funadmin=$fd->where(array(adminid=>$uid))->field(true)->select();

$this->funadmin=$funadmin;

$this->display();

}