RE: [PHP] msession - giving me a hard time
| From: | Guillaume Dupuis | Date: | Fri, 14 Nov 2003 23:34:57 +0000 |
| Subject: | RE: [PHP] msession - giving me a hard time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169702@lists.php.net to get a copy of this message | ||
Quote from PHP Manual:
"PHP is capable of transforming links transparently. Unless you are using
PHP 4.2 or later, you need to enable it manually when building PHP. Under
UNIX, pass --enable-trans-sid to configure. If this build option and the
run-time option session.use_trans_sid are enabled, relative URIs will be
changed to contain the session id automatically."
I have 4.1.2 installed.
Thanks,
Guillaume
-----Original Message-----
From: Guillaume Dupuis [mailto:guillaume.dupuis@sand.com]
Sent: Friday, November 14, 2003 6:20 PM
To: CPT John W. Holmes; php-general@lists.php.net
Subject: RE: [PHP] msession - giving me a hard time
This is now my initial page:
<?php
session_start($_GET['SID']);
echo SID;
?>
And it returns nothing to me. I must be retarded, your explanation is soooo
simple!
Thanks again,
Guillaume
-----Original Message-----
From: CPT John W. Holmes [mailto:holmes072000@charter.net]
Sent: Friday, November 14, 2003 5:57 PM
To: Guillaume Dupuis; php-general@lists.php.net
Subject: Re: [PHP] msession - giving me a hard time
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...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php