PHP manipulating SESSION - How to disconnect MULTIPLE SESSIONS

Asked

Viewed 19 times

1

Good morning!

It is important to note that this question is about SEVERAL SESSIONS, since I searched the forum and the questions on similar subject refer only to one session.

After several tests to learn $_SESSION I opened several sessions on my server and browser. Now when I try to open new ones I am blocked, or the variables do not go to the next page. This is a simple login system with Mysqli and $_SESSION.

Sample code: Page 1

<?php
session_start();

$_SESSION['validade']=date('H:m:s');
$_SESSION['nome']=$_POST['nomePrimeiro'];
$_SESSION['segundoNome']=$_POST['nomeSegundo'];
*** (resto do código)
?>

Sample code: Page 2

<?php
session_start();

$_SESSION['nome'];
$_SESSION['segundoNome'];

if($_SESSION['validade']>$_SESSION['validade']+'1:00:00'){
(...logout)
}ELSE{
(...autoriza abertura da página inicial)
}
?>
No answers

Browser other questions tagged

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