Session Variables Don't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Session Variables Don't work

Postby whitets » 20. April 2005 17:24

I have installed Xampp on my home computer (laptop) and it works great. Kudos to the developers. After trying to coordinate Mysql and PHP and Apache for 2 days, I installed this in 10 minutes!

However, I have found that session variables don't work. The pages I installed on my main web server online work just fine so it probably isn't the code. The session.auto_start variable in php.ini is set to 0 which is correct. I have put session_start(); at the top of my pages. I set the session variable with:

$_SESSION['menu'] = "officer";

If I check on that page the $_SESSION variable is set.

On the next page I try to read the variable as:

$menu = $_SESSION['menu']

$_SESSION['menu'] is null at that point.

Any ideas of setting to change?

Thanks.

Stan White
whitets
 
Posts: 6
Joined: 20. April 2005 16:59

Postby taustin » 20. April 2005 19:09

I am far, far from an expert on this, but the example code I started with has a session_register between session_start and assigning values. IIRC, it is absolutely required.
taustin
 
Posts: 150
Joined: 24. September 2004 00:23
Location: Huntington Beach CA

Postby whitets » 20. April 2005 19:32

Thanks, Taustin. However, session_register() isn't required. I have never used it on other servers and the pages work just fine there. I did try it here again, but to no avail.

Stan White
whitets
 
Posts: 6
Joined: 20. April 2005 16:59

Postby Wiedmann » 20. April 2005 19:46

On the next page I try to read the variable as:

How did you go to the next page?

(Think about the SID...)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby whitets » 20. April 2005 19:51

I use

echo "<script language=javascript> parent.location.href='index.php'; </script>;

to go to the next page.
I checked the SSID on several pages after starting the session and the number changes with each page so the session didn't actually take.

I am using localhost for my server. I read a hint somewhere that all links must use www. at the front. Is this true? I don't use that anywhere on my online server and everything works just fine there.

thanks.
whitets
 
Posts: 6
Joined: 20. April 2005 16:59

Postby whitets » 20. April 2005 20:05

I found the problem. I use Zonealarm as my firewall. It has a site in the Privacy/Site List labelled Loopback which, as I understand it, is a program 'looping back' to 127.0.0.1 - i.e my computer. I had the settings for the Loopback set for enabling Mobile Code, Allowing cookie Control Session and Persistent, but not allowing for 3rd party. I changed that last setting to allowing 3rd party for Loopback and it now works just fine. 8-)

Stan
whitets
 
Posts: 6
Joined: 20. April 2005 16:59


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 96 guests