Re: msession - giving me a hard time
| From: | CPT John W. Holmes | Date: | Fri, 14 Nov 2003 22:56:49 +0000 |
| Subject: | Re: msession - giving me a hard time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169699@lists.php.net to get a copy of this message | ||
From: "Guillaume Dupuis" <guillaume.dupuis@sand.com>
> I've tried your suggestion and yes, I am transferring the SID variable to
> the next page... but I don't know if I am doing the this right.
>
> This is the code I use:
> ---
> <?php
> session_start();
> $SID = session_id();
> echo $SID;
> ?>
>
> <a href="http://192.0.1.7/use.session.php?SID=<?php
> echo
> $SID?>">LinuxBox2</a>
> ---
If you used
session_start($_GET['SID']);
on your pages, this would work. The session ID that PHP is looking for is
named PHPSESSID by default. That's why you should use the SID _constant_
<a href="http://192.0.1.7/use.session.php?<?php echo
SID; ?>">LinuxBox2</a>
If PHP doesn't pick up a session id, you'll just end up with a new one
created the next time you call session_start().
> So to recap:
> 1- Do I need session_start() at the beginning of each php pages?
Yes, you need it on any page you want to access the session in.
> 2- Do I need msession_connect/create?
Dunno about that...
> 3- Am I right to use $SID as a good tracking assumption (if I get the same
> SID thru several pages, this means msession works well???)?
If you get the same session id after calling session_start() on your pages,
then yes, it should be working. Using the above method with SID should get
you this.
---John Holmes...