phicarre
|
User
|
|
registriert
|
04.03.2009
|
wohnt in
|
|
Beiträge
|
1
|
|
Sorry but I forgot my german ...
Your script doesn't work in case of concurrency access with the same SID.
Here is the test:
1) init the session and call an html module in which one script is called 20 times
Code:
<?php
require_once('mySess.php');
session_start();
$_SESSION["count"] = 1;
?>
<HTML>
<HEAD>
<TITLE>concurrency test</TITLE>
</HEAD>
<BODY>
<a href="frametest.html">Go to frametest</a>
</BODY>
</HTML>
2) the page with the 20 frames
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
<TITLE>concurrency test</TITLE>
</HEAD>
<FRAMESET
rows="5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%,5%">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
<FRAME src="phpsessiontest.php">
</FRAMESET>
</HTML>
3) the executed script
Code:
<?php
require_once('mySess.php');
session_start();
$_SESSION["count"] = $_SESSION["count"] + 1;
// spend some time, sleep 1 second
sleep(1);
echo $_SESSION["count"];
?>
4) you should have 2,3,4,....
|