Created
March 26, 2014 14:24
-
-
Save anytizer/9784541 to your computer and use it in GitHub Desktop.
https sessions tester
This file contains hidden or 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 | |
/** | |
* Script to test session data sharing in http and https versions | |
* Theme: session initiated by HTTP should be accessible to HTTPS and vice-versa | |
* http://localhost/https/session.php | |
* https://localhost/https/session.php | |
*/ | |
session_start(); | |
header('Content-Type: text/plain'); | |
if(!isset($_SESSION['counter'])) | |
{ | |
$_SESSION['counter'] = 0; | |
} | |
++$_SESSION['counter']; | |
$is_https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on'; | |
$https_status = ($is_https)?'ON':'OFF'; | |
echo " | |
Counter: {$_SESSION['counter']} | |
HTTPS Status: {$https_status} | |
"; | |
print_r($_SESSION); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment