User’s personal account

How to make it so that when entering the site (login, password), the user enters YOUR personal account, i.e. I saw only my messages, etc. I understand how to display a query to the database, but here’s how to make it so that you don’t have to enter a login password on every page.


Answer 1, authority 100%

Read on session_start()and $_SESSION

:
    <?php
      session_start();
      $_SESSION['user'] = "Irina";
      echo '  : '.$_SESSION['user'];
    ?>
 :
<?
  session_start();
  echo $_SESSION['user'].',     ';
?>

Answer 2, authority 50%

Sessions, read, learn, use


Answer 3, authority 50%

After successful authorization, write user data to cookies or session.

Check for the presence of such data in cookies and sessions, if any, check against the database for the correctness of this data, then allow to work further.


Answer 4

Well, in order not to display something on each page, you need to transfer the repeating fragment to the included file. Well, respectively, connect it using include.


Answer 5

Soon the hashcode will ask – “how to wash a down jacket”.
Here is an example of registration, using a database and sessions, the topic has examples using files and a database to record users and passwords.

Example of authorization/registration/logout (on files and database)