note 44576 added to function.session-id
| From: | philip at osu1 dot php dot net | Date: | Tue, 10 Aug 2004 03:52:40 +0000 |
| Subject: | note 44576 added to function.session-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74380@lists.php.net to get a copy of this message | ||
You may use this to pass a session along multiple domains on the same server as long as the first
domain passes the session id along with the request to the new domain (i.e. via GET or POST, a
COOKIE will not work). This assumes the session data is stored in the same place.
// domain #1
<?php
session_start();
$_SESSION['var'] = 'a value';
?>
<a href="http://example.com/a.php?sid=<?php echo
session_id(); ?>">go here</a>
// domain #2
<?php
session_id($_GET['sid']);
session_start();
// You are now sharing the same session.
echo $_SESSION['var'];
?>
----
Manual Page -- http://www.php.net/manual/en/function.session-id.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44576
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44576&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44576&report=yes
Search -- http://master.php.net/manage/user-notes.php