Logo - MyWebsolution.de
User gesamt  :  1651462
User online  :  1
KubaSeoTräume, PHP Forum, PHP Community and more ... MyWebsolution.de!
   
   
 
Registrieren Login User F.A.Q Suche Home

eingeloggt bleiben

MyWebsolution.de Foren » Anfängerfragen PHP und MYSQL » About the "sessions in PHP"

Seite: 1 Posts pro Seite: 5 10 20
Autor Thread
04.03.2009 19:44 Uhr About the "sessions in PHP"
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,....
Profil ansehen
Seite: 1 no reply
Powered by Pascal Landau © 2006 MyWebsolution.de
Designed by Pascal Landau © 2006 MyWebsolution.de
 
 
 
 
Home Email Impressum Disclaimer Statistik