note 44560 deleted from ref.session by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 09 Aug 2004 21:51:20 +0000 |
| Subject: | note 44560 deleted from ref.session by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74354@lists.php.net to get a copy of this message | ||
Note Submitter: sijmen@digitized.nl
----
This problem took me 2 full days, the concept:
- page 1 is loaded by the visitor.
- page 1 gets the content of page 2, also on the server and gives the session id from the visitor
through the URL that it loads
- page 2 loads the session id and returns the content
<?php
// page 1
session_start();
print session_id().'<br>';
readfile("http://x/page2.php?".session_name().'='.session_id());
?>
<?php
// page 2
if (isset($_GET[session_name()]))
session_id($_GET[session_name()]);
session_start();
print session_id();
?>
let's say the session id of the visitor is: 43c153b3a80a0b90351520b9fa3d907f
then you whould expect the following output:
43c153b3a80a0b90351520b9fa3d907f
43c153b3a80a0b90351520b9fa3d907f
but the result of the following two scripts is that it will result in:
Fatal error: Maximum execution time of 30 seconds exceeded in ..
Session files are locked so no other user can modify it if it's in use. The solution would be:
<?php
// page 1
session_start();
# get our session id - update the session file and close it
$sid = session_id();
session_write_close();
print "$id<br>";
readfile("http://x/page2.php?".session_name()."=$sid");
# continu our session
session_id($sid);
session_start();
?>
Regards
Sijmen Ruwhof