Losing session vars in windows xp professional

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
clem_c_rock
Forum Commoner
Posts: 46
Joined: Mon Jun 07, 2004 9:18 am

Losing session vars in windows xp professional

Post by clem_c_rock »

Good Morning,

I've come across a curious problem concerning windows xp. I have a database program that uses a frameset as the html structure. I'm using a session variable to pass a user id across the frameset. I've tested this script in about every browser imaginable from Safari, Opera, Netscape, Firefox, IE, Mozzilla on both mac os 10, and many flavors of windows. In short - It works flawlessly on all.

My friend who uses the program has Windows XP professional and, on most days, cannot use the program because the browser loses the session variables when you enter the page. After the session vars are set, and you test the existance of session vars apon entering the program w/ the print_r( $_SESSION ) method, the session array is empty.

The strangest part is I have windows XP pro on my work machine and It works fine on this machine.

I'm completely stumped.
Thanks Clem C
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

I'm confused - are you saying that it's his BROWSER that forgets the session - or is this some kind of application he has installed on his XP box that doesn't work right?
clem_c_rock
Forum Commoner
Posts: 46
Joined: Mon Jun 07, 2004 9:18 am

Post by clem_c_rock »

At this point, I cannot tell what it's doing. Having the browser lose the session seems to defy the very laws of php. I asked my friend to download Mozzilla and the same thing happened in the Mozilla browser. To give you more details in how the program works: The program is a contact admin for a group of teachers who login to the program and create these session vars: user_id, user_level.

at an administrators level, the administrator can view all teachers and their subsequent students. From a dropdown menu at the top frameset, you can choose which teacher you want to view students from. The choice will update the session variable of teacher_id which can be read from all the frames. At this point all session variables disappear and you are automatically logged out of the program. Now this doesn't happen all the time. There are some lucky days where it will work perfectly. My only thought ( given that session vars are created on the server it doesn't really make sense ) is maybe my friend has a specific XP pro update that is causing the problem.

I am completely stumped.

Thanks for your time,
Clem C
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

I was really trying to ask if this was an application he ran on his own PC, or he's just having problems when accessing a web site you'd built? But I guess it's the later.
Having the browser lose the session seems to defy the very laws of php
All the browser would have to do is loose the cookie that holds the session and PHP would become somewhat confused. There are so many things that could cause this its almost not funny.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I had this problem when all the pages in the different frames would set the session.. I'd get a session for each frame in mozilla.. I'd get a mismatched one in IE..
clem_c_rock
Forum Commoner
Posts: 46
Joined: Mon Jun 07, 2004 9:18 am

Post by clem_c_rock »

Thanks again for getting back to me on this. Yeah this application is a web site that he is accessing from his home computer.

Yeah actually now that you mention it that cookie makes a great deal of sense. My suspician was that in light of microsoft's efforts to combat their system's vulnerabilities my friend may have different XP patchs on his home computer than the XP pro I have at work. I never had the need to use cookies and PHP much. Any quick suggestions to diagnose the existance of the cookies?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Just to rule out any other application specific things you could have him test a simple session page such as:

Code: Select all

<?php
session_start();
if(empty($_SESSION['count'])){
    $_SESSION['count'] = 1;
} else {
    $_SESSION['count']++;
}
echo $_SESSION['count'];
?>
If the counter doesn't increment when he reloads the page then you'll know that it is specifically sessions/cookies that are causing his problem and not 'something else' in your site.
clem_c_rock
Forum Commoner
Posts: 46
Joined: Mon Jun 07, 2004 9:18 am

Post by clem_c_rock »

Good Idear. If it's losing the sessid cookie, this may require a quite funky workaround.

Thanks again

Hey feyd - what did you do to solve your dilemma?

Clem C
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I tossed out the cookie setting in all but 1 frame. And just made the others compliant with it not being available until a reload of the page(s) happen..
Post Reply