How to show that the user is logged in to the pages he visits?

Asked

Viewed 46 times

-1

How do I make the after the user logs in, that he can see in some corner of the screen his name with some information from him with that login and that when he presses the "back" or "exit" button a question appears if he really wants to proceed, and if it confirms for it to log out and return to the index.

1 answer

1

uses php session variables

session_start();
$_SESSION['nome_da_variavel'] = valor da variavel;

example:

session_start();
$_SESSION['nome'] = "joao";
echo $_SESSION['nome'];

Obs: it is possible to use the variables declared per session on several pages, they are stored while the browser is open, which facilitates on login system.

and to leave, or to return, just use the

session_destroy();

that ends/destroys all values of session variables

Browser other questions tagged

You are not signed in. Login or sign up in order to post.