Created
July 11, 2017 09:59
-
-
Save Stiofan/b7dc95866a6d45847ae90fc6bc9c9a3c to your computer and use it in GitHub Desktop.
Test Sessions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set error reporting to display all errors and notices | |
error_reporting(E_ALL); | |
// Start a session | |
session_start(); | |
// Check for the existence of a known session variable | |
if (isset($_SESSION['test_value'])) { | |
_e('Test value (should increase by 1 on each page refresh): '); echo $_SESSION['test_value']; | |
$_SESSION['test_value']++; | |
} else { | |
_e('No session exists - writing to test_value, refresh to check.'); | |
$_SESSION['test_value'] = 1; | |
} | |
// Close and write session | |
session_write_close(); | |
$foldername = session_save_path(); | |
if (is_writable($foldername)) { | |
echo '<br>The Sessions folder is writable'; | |
} else { | |
echo '<br>The Sessions folder is not writable'; | |
} | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment