note 44576 deleted from function.session-id by aidan
| From: | aidan@php.net | Date: | Thu, 26 Aug 2004 12:27:42 +0000 |
| Subject: | note 44576 deleted from function.session-id by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75328@lists.php.net to get a copy of this message | ||
Note Submitter: philip
----
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'];
?>