Problem with session variables on Mac
From: Jim & Sara Feldman (feldmans_at_rcn.com)
Date: 12/25/03
- Next message: Evan Nemerson: "Re: [PHP] programming the onclick() event in an anchor"
- Previous message: -{ Rene Brehmer }-: "Re: [PHP] JavaScript question"
- Next in thread: Mike Migurski: "Re: [PHP] Problem with session variables on Mac"
- Reply: Mike Migurski: "Re: [PHP] Problem with session variables on Mac"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Dec 2003 00:43:43 -0500 To: php-general@lists.php.net
I should first admit to being a php newbie, so the answer may
be obvious, but this looks like a
bug to me. Global variables are OFF. I start a session at the very
top of page "member.php":
session_start();
In a function called from the same page, I store some variables in
the session array:
$pilot = mysql_fetch_array($result);
$usrname = $pilot['given']." ".$pilot['last'];
$valid_ID = $pilot['ID'];
$timestamp = date("U");
session_register("usrname","timestamp","valid_ID");
then in another function called from the same page (or a different
page, since this is where I find which
user is sending in a page), I attempt to use the "timestamp" data.
Three "echo" lines are added to provide
some debugging help.
if (session_is_registered("valid_ID")){
echo "inside check IF <br>";
$current_time = date("U");
echo "Time = $current_time.<br>";
$session_time = $current_time - $_SESSION('timestamp');
echo "session time = $session_time seconds.<br>";
The output to the browser (Safari) is as follows:
inside check IF
Time = 1072308706.
Fatal error: Call to undefined function: array() in
/Library/WebServer/Documents/testit/Logsafe_project/user_auth_fns.php
on line 35
As you can see, the code bombs as soon as it hits the
$_SESSION('timestamp'). Note that it did pass through
(session_is_registered("valid_ID") successfully and if I go look in
the directory where the cookie would go,
it is there.
I am operating in system 10.3.2 (Panther) and, as far as I
can tell, using php 4.3.2. Any help would be appreciated.
Jim
-- Jim Feldman 14 Linda Lane Newton, MA 02461 617-527-0509
- Next message: Evan Nemerson: "Re: [PHP] programming the onclick() event in an anchor"
- Previous message: -{ Rene Brehmer }-: "Re: [PHP] JavaScript question"
- Next in thread: Mike Migurski: "Re: [PHP] Problem with session variables on Mac"
- Reply: Mike Migurski: "Re: [PHP] Problem with session variables on Mac"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|