RE: Session Variables Problem (Missing)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I consistently had problems with the Session variable not carrying out
globally.
So I have this rather convoluted example; when I can refine it I can send it
again, but it works fine.

This is on Win2k, Apache 2.0, PHP Version 4.3.1

// name the session
session_name('s');

// check if a session exists
if(!session_id()){
	session_start();
}

// register session variables
if (!session_is_registered("sesspatientID")) {
	session_register("sesspatientID");
	session_register("idAsset");
}

// assign session variables
if (isset($_POST["idAsset"])) {
	$idAsset = $_POST["idAsset"];
	$_SESSION["idAsset"] = $idAsset;
} elseif (isset($_GET["idAsset"])) {
	$idAsset = $_GET["idAsset"];
	$_SESSION["idAsset"] = $idAsset;
}

if (isset($_POST["patientID"])) {
	$patientID = $_POST["patientID"];
	$_SESSION["sesspatientID"] = $patientID;
}

// this is the part I had to add to make it work
if (isset($_SESSION["sesspatientID"])) {
	$sesspatientID = $_SESSION["sesspatientID"];
}

if (isset($_SESSION["idAsset"])) {
	$idAsset = $_SESSION["idAsset"];
}

Thanks,

John Ellingsworth
http://mail.med.upenn.edu/~jellings/
AIM: vc2000support

-----Original Message-----
From: Jennifer S. [mailto:jennifer_p_s@yahoo.com.au]
Sent: Saturday, January 10, 2004 5:36 AM
To: Brad Lawryk; php-windows@lists.php.net
Subject: Re:  Session Variables Problem (Missing)


Hi,
Seems to work OK. I consistently got the same session ID
I am in a similar situation, moving all my ASP apps to PHP. I run Apache 2.0
on Win 2000 servers. I have actually traced the sessions in the PHP session
data directory and found things to be working consistently and well.
Are you using IIS or another web server?

Cheers,

Jennifer

Brad Lawryk <webmaster@wltimberwolves.com> wrote:
I am new to PHP moving over from ASP and one of things I relied on heavily
was session variables. It seems that everytime a new page is opened it
starts a new session.

I have set up a simple test site you can see whats happening - easier than
to explain.

http://www.cflsquad.com/index.php

Use
Username: testuser
Password: testpassword

the next page after log in should read "You are logged in as: testuser".
What tells me is that the session variable is resetting to a new on each
page is that the 'testuder' text doesn't show becuase the session var is
being read. These exact same pages work fine oon a Linux server so I know
its a Windows Server issue. The odd thing is that the session ID is passed
and saved but the session variable that is created on log in is not passed.
Again, it woks just fine on a Linux server - just not Windows.

I have changed the path in the php.ini file as many have suggested fixes the
problem but it hasn't made a difference for me.

Thanks

--
Brad Lawryk
Williams Lake TimberWolves
www.wltimberwolves.com

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



---------------------------------
Yahoo! Personals
- New people, new possibilities. FREE for a limited time!

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux