On Tuesday 17 August 2004 17:46, Angelo Zanetti wrote:
> Still no luck with sessions. I have installed an older version: 4.3.1
> and have register_globals=Off
>
> I have 2 test pages a1.php and a2.php
>
> All I want to do is register a session variable, set a value for it and
> then in a2.php check that it is still registered and view the session's
> value.
>
> a1.php:
>
> <?
> session_start();
> header("Cache-control: private"); // IE 6 Fix.
>
> if(isset($_POST['Submit']))
> {
> $_SESSION["login"]="inside";
> session_write_close();
> header("Location: a2.php");
> exit();
> }
> ?>
>
> I can successfully register the session variable and set the value of
> it on page a1.php
Are you positive that $_SESSION["login"] is set? Is your browser accepting
cookies (at the least temporary or session cookies?).
> but when I go to page a2.php the session variable is
> not set and the value isnt set either.
>
> a2.php:
>
> <?
> session_start();
> header("Cache-control: private"); // IE 6 Fix.
>
> if(!isset($_SESSION["login"]))
> echo("<br>session variable NOT set");
> else
> echo("<br>session variable set");
>
> echo("<br>session ID: " . session_id());
> echo("<br>session value: " . $_SESSION["login"]);
>
> ?>
OK, do you have access to the directory (assuming you're using files) that
stores the session files? If so, check the session file written in a1.php to
see whether $_SESSION["login"] was set correctly, then check session_id() in
a2.php matches that the name of said session file.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Work continues in this area.
-- DEC's SPR-Answering-Automaton
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php