Registration With User Rights Separation in PHP

When adding user rights, we need to make changes to our registration. Now, when registering a user, we must specify their status in the INSERT query.

Usually, during initial registration, all users of our site receive the lowest status, which in our case is 'user':

html<?php
  $query = "INSERT INTO users
    SET login='$login', password='$password', 'status'='user'";
?>

Higher statuses are usually assigned by the administrator. They see the list of users in the admin panel and can make anyone, for example, an administrator.

How then will the first administrator appear on the site? The simplest way: register a regular user and make them an admin via PhpMyAdmin.

A more complex way: during the first launch on the hosting, run the site installation, ask for a login and password using a form, and register the very first user of the site, assigning them the administrator status.

Задание 1

Modify the registration code so that all added users receive the status 'user'.

Задание 2

Manually change the status of some user to 'admin'. Log in under this user.

Задание 3

Create a page admin.php that will only be accessible to users with the status 'admin'.

Задание 4

Display a list of all registered users of your site on the page admin.php in the form of a table. Let the table have two columns: login and status.

Задание 5

Modify the previous task so that a third column also appears, with a link that allows the admin to delete any user.

Задание 6

Modify the previous task so that the table rows with admins are colored red, and with regular users - green.

Задание 7

Modify the previous task so that one more column appears. In this column, the admin will be able to change user rights. Make it so that for all regular users there is a link make them an admin, and for an admin - a link make them a user.

Задание 8

Make it so that on all pages of the site, in the header, a registered user sees their login and status.

Задание 9

Modify the previous task so that for admins, the site header also shows a link to the admin panel.