Reply to Re: why a session-based program behaves different on different computers

Your name:

Reply:


Posted by davidkoree on 04/20/07 05:15

Thank you very much Steve.

I will consider your recommendations seriously, that must be more
stable than using cookie/session methods.

Yesterday I checked my program and I found that there're two problems
which made things bad.

Let me show them:

<?php
require_once("F5S.php");
session_start();

print_r($_SESSION["f5s"]->_status); // -- bad one --
/* This is bad one.
* For example, if user has finished 3 steps, the $_SESSION["f5s"]-
>_status should be:
* { [step_1] => done, [step_2] => done, [step_3] => done }
* But on some client computers the $_SESSION["f5s"]->_status may look
like this:
* { [step_1] => done, [step_3] => done }
* or this:
* { }
* If we refresh the browser on or more times, the $_SESSION["f5s"]-
>_status would be complete (or uncomplete).
*/

if (isset($_SESSION["f5s"])) { // -- bad two --
/* This IF is bad two, it doesn't return TRUE on some client
computers.
* But if we refresh the browser one or more times, the
$_SESSION["f5s"] could be ok (or not ok).
* Just like bad one.
*/

$_SESSION["f5s"]->setFileName(__FILE__);

if (count($_POST) > 0) {
$_SESSION["f5s"]->collectData($_POST);
$_SESSION["f5s"]->updateStatus();
$_SESSION["f5s_data"] = $_SESSION["f5s"]->_data;
$_SESSION["f5s_status"] = $_SESSION["f5s"]->_status;
} elseif ($_SESSION["f5s"]->checkWorkflow()) {
$_SESSION["f5s_data"] = $_SESSION["f5s"]->_data;
$_SESSION["f5s_status"] = $_SESSION["f5s"]->_status;
} else {
$_SESSION["f5s"]->routeWorkflow();
}

} else {

$_SESSION["f5s"] = new F5S();
$_SESSION["f5s"]->setFileName(__FILE__);
$_SESSION["f5s"]->routeWorkflow();

}
?>

The the server environment is PHP 5.1.4/Linux/Apache 2.0.

I just searched bugs on php.net, and my issue seems like 'sessions are
dropped randomly'.
See more details please go to http://bugs.php.net/bug.php?id=37382

And a bogus bug is inspiring me.
See more details please go to http://bugs.php.net/bug.php?id=37444

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация