RE: [PHP-WIN] AW: Sessions
| From: | James Duncan | Date: | Sun, 27 Aug 2000 19:12:56 +0000 |
| Subject: | RE: [PHP-WIN] AW: Sessions | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2188@lists.php.net to get a copy of this message | ||
I have any idea but it might be stupid or not possible. Would it be possible
to make PHP intelligent with regards sessions? If cookies are disabled (in
PHP.INI) or the client has them disabled then PHP automatically includes the
SID in the URI (like --enable-trans-sid compiled option) whilst the session
is open? This would remove the hassles and confusion for bad programmers
like me ;)
Comments? (Please don't shout too loud).
James
-----Original Message-----
From: Daniel Beulshausen [mailto:daniel@php4win.de]
Sent: 27 August 2000 19:27
To: 1193-639-1; James Duncan
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] AW: Sessions
hi
> hope it's a nice morning in uk
atleast it's a nice evening in germany :)
> I've solved the session - problem
> (had set an directory to session.save_path and it seems that
> php does't like that, even it exists)
had php full access right's to that dir?
> <?
> session_register("x")."<br>";
> $x=12;
> echo SID."<br>";
> $s=SID;
> echo "<a href=session2.php?$s>go to 2</a>";
> ?>
bad snippet :) it misses atleast session_start()
<?
session_start();
$x=12;
session_register("x");
echo "<a href=session2.php?" . SID . ">go to 2</a><br>";
?>
> session2.php
> <?
> session_start();
> echo SID."<br>";
> echo session_is_registered("x")."<br>";
> echo $x."<br>";
> ?>
<?
session_start()
print SID . "<br>";
if(session_is_registered("x"))
print $x;
?>
it all behaves like i expected it too, but continue reading.
> "The <?=SID?> is not necessary, if --enable-trans-sid was used to compile
> PHP. "
> (from php.net) // the <?=SID?> is wrong!!
it's not wrong. and it's only needed if you don't use cookies.
SID is a normal constant:
<html>
<blabla>
<a href="link.html<?=SID?>">your SID: <?=SID?></a>
btw:
you can double check with
if(defined("SID"))
print SID;
and there's a difference between SID and session_id()
SID = session_name() . "=" . session_id();
> to send the SID via get in the URI is 'ugly' and perhaps Daniel
Beulshausen
> [daniel@php4win.de]
> is able to fix that ??
so you want a binary compiled with trans-sid? and what bug, we may call it a
feature...
if you want to use this method turn off session.use_cookies, then you may
supply the SID in the URL.
if you have cookies turned on it won't work like expected, cause it get's
overridden by the cookie.
cause the SID is only necessary for the url, it's not the session id!
so i think it's a feature (expected behaviour)
> I think at the moment it only works via URI
and via cookies, check your setting's in the php.ini for
session.use_cookies.
greetings
daniel
/*--
daniel beulshausen - daniel@php4win.de
using php on windows? http://www.php4win.de