PHP Code:
<?php
if(empty($_SESSION['test'])){
session_start();
$_SESSION['test'] = "Session has started";
print_r($_SESSION['test']);
echo "<a href='destroy.php'>Destroy</a>";
}else{
die("Session is not started");
}
?>
Or if you still prefer using !isset
PHP Code:
<?php
if(!isset($_SESSION['test'])){
session_start();
$_SESSION['test'] = "Session has started";
print_r($_SESSION['test']);
echo "<a href='destroy.php'>Destroy</a>";
}else{
die("Session is not started");
}
?>
Destroy.php
PHP Code:
<?php
session_destroy();
header("refresh:0; url=index.php");
?>