Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Session write lock example scripts
This is the output per the code executing exactly as it is in this gist.
== Output from session_locker.php: ==
Second file output:
Array
(
[bar] => foo
[foo] => bar
)
sid: q5n46aqf6kc5nladohs81vj217
Array
(
[bar] => foo
[foo] => bar
[stuff] => things
[otest] => overwitten!
)
Main file output:
Array
(
[bar] => foo
[foo] => bar
[otest] => testing
)
== Output from session_viewer.php: ==
Array
(
[bar] => foo
[foo] => bar
[stuff] => things
[otest] => overwitten!
)
<?php
session_start();
$_SESSION['bar'] = 'foo';
$_SESSION['foo'] = 'bar';
session_write_close();
$_SESSION['otest'] = 'testing?';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/session_user.php?id='.session_id());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$head = curl_exec($ch);
echo "Session_user.php output: <br/><br/>\n\n<pre>";
echo $head;
echo "</pre>\n\n<br/><br>Session_locker.php output (after session_user.php was run): <br/><br/>\n\n<pre>";
print_r($_SESSION);
echo "</pre>";
?>
<?php
session_id($_GET['id']);
session_start();
print_r($_SESSION)
$_SESSION['stuff'] = 'things';
$_SESSION['otest'] = 'overwitten!';
echo "sid: " . $_GET['id'] . "<br> \n";;
print_r($_SESSION);
?>
<?php
session_start();
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.