I'm working through troubleshooting PHP sessions. I have the following code:
// Start Session
session_start();
// Show banner
echo '<b>Session Support Checker</b><hr />';
// Check if the page has been reloaded
if(!isset($_GET['reload']) OR $_GET['reload'] != 'true') {
// Set the message
$_SESSION['MESSAGE'] = 'Session support enabled!<br />';
// Give user link to check
echo '<a href="?reload=true">Click HERE</a> to check for PHP Session Support.<br />';
} else {
// Check if the message has been carried on in the reload
if(isset($_SESSION['MESSAGE'])) {
echo $_SESSION['MESSAGE'];
} else {
echo 'Sorry, it appears session support is not enabled, or you PHP version is to old. <a href="?reload=false">Click HERE</a> to go back.<br />';
}
}
This code returns session support is not enabled. However, when running
phpinfo();
So I'm not sure what I'm doing wrong or right. Is there a better/easier or more definitive way to test for sessions?
Here is the URL: https://tacnetusstage.wpengine.com/session.php