Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Session write lock example scripts

View example_run1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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!
)
View example_run1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?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>";
?>
View example_run1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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);
?>
View example_run1.txt
1 2 3 4 5 6 7 8
<?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.