Skip to content

Instantly share code, notes, and snippets.

@thiagomgo
Last active November 30, 2016 02:54
Show Gist options
  • Save thiagomgo/d9292ac478df78b746c8d1d0a997c86e to your computer and use it in GitHub Desktop.
Save thiagomgo/d9292ac478df78b746c8d1d0a997c86e to your computer and use it in GitHub Desktop.
Script to check the PHP Session Support
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$DATE = date('m/d/Y h:i:s a', time());
// 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 /> SESSION_ID: '.session_id().'<br /> COOKIE: '.$_COOKIE[session_name()];
// 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'];
echo '<br /><br />Last run time: '.$DATE;
} 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 />';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment