AW: [PHP-WIN] AW: Sessions
| From: | Klaus Schmidt | Date: | Mon, 28 Aug 2000 05:28:47 +0000 |
| Subject: | AW: [PHP-WIN] AW: Sessions | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2195@lists.php.net to get a copy of this message | ||
#atleast it's a nice evening in germany :)
jo :-)
#> (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?
was just misspulled :-)
#
#> <?
#> 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()
no, each call to session_register() automatically calls session_start() :)
and starts a new session, if there is none.
(at least, it works !)
#<?
#session_start(); //1:
#$x=12;
#session_register("x"); //2:
#echo "<a href=session2.php?" . SID . ">go to 2</a><br>";
#?>
1: your first line produces a 'illegal function call' (here?) and php stops
2: all examples on php.net showing an other order
first: register, second: set a value: (shoudn't make any differences or?)
//but without session_start (!)
<?php
session_register("count");
$HTTP_SESSION_VARS["count"]++;
?>
#> session2.php
#> <?
#> session_start();
#> echo SID."<br>";
#> echo session_is_registered("x")."<br>";
#> echo $x."<br>";
#> ?>
#
#it all behaves like i expected it too, but continue reading.
I'v stopped to 'expect' anything in php a few weeks ago :-)
#
#> "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:
okay
#>only via URL
#and via cookies, check your setting's in the php.ini for
#session.use_cookies.
is set to on, I'll try that, thanx
cu
Klaus Schmidt