note 70235 added to function.session-start
| From: | evil dot 2000 at web dot de | Date: | Sat, 07 Oct 2006 23:06:08 +0000 |
| Subject: | note 70235 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118195@lists.php.net to get a copy of this message | ||
I had a problem accessing a session which is open in another frame at the same time.
I had a frame, which is displaying a live text like a chat. It has an opend and locked session. I
tried to add data to this session with another frame, but this wouldn't work.
In the first frame i had a loop which is looking for fresh data in the session and prints it out
like this:
<?php
session_start();
[...]
while (true) {
echo $_SESSION["input"]."\n";
sleep(1);
}
?>
But this locks the session, and no other frame can access the session data at the same time.
So i modified this loop a bit like this:
<?php
session_start();
[...]
session_commit();
while (true) {
ob_start(); session_start(); ob_end_clean();
echo $_SESSION["input"]."\n";
session_commit();
sleep(1);
}
?>
Now the second frame is able to access the session.
The ob_start() and ob_end_clean() is just for surpressing the cookie output to the browser.
----
Server IP: 217.13.201.10
Probable Submitter: 88.72.158.117
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/70235
Del: integrated -- https://master.php.net/note/delete/70235/integrated
Del: useless -- https://master.php.net/note/delete/70235/useless
Del: bad code -- https://master.php.net/note/delete/70235/bad+code
Del: spam -- https://master.php.net/note/delete/70235/spam
Del: non-english -- https://master.php.net/note/delete/70235/non-english
Del: in docs -- https://master.php.net/note/delete/70235/in+docs
Del: other reasons-- https://master.php.net/note/delete/70235
Reject -- https://master.php.net/note/reject/70235
Search -- https://master.php.net/manage/user-notes.php