I can't access session data.
In index.php I have this code and $_SESSION['token']
is not empty:
<?php
include "classes/session.php";
include "classes/token.php";
// include "classes/login.php";
use Biboletin\Session;
use Biboletin\Token;
Session::start();
var_dump($_SESSION);
?>
Down in the code in the same file i also have line
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>" />
This is the method generate() In token.php:
public static function generate()
{
Session::start();
return Session::set('token', bin2hex(random_bytes(32)));
}
The action of the form is pointing to login.php where I var_dump($_SESSION)
and there is nothing.
I have Session::start()
in all files.
And this is the method start():
public static function start()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}