473,569 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clash of session variables - 2 windows, same or different application

(This is a bit like the recent thread "PHP Switching Sessions".)

I use session_start() . When I open my web-based application in two windows
on the same system, there's a definite clash; I can't do two independent
sessions because the session variables are shared. I solved that
the easy way, by not opening two windows. But then I went on to write
more applications, and found that if I use the same variable names
(for session variables) in different applications I get that same
clash. That I couldn't live with. Now I do this;

session_name ("name_of_appli cation");
session_start ("");

which seems to protect the applications from each other. Questions:

1) Is this likely to really work? It seems to, but I could just be
testing it badly.

2) Is this likely to cause nasty side-effects, like giving every
user (on different computers) access to the same named session?
It looks OK so far, /var/lib/php4 still has random-looking
filenames; I was afraid the session files would be named
"name_of_applic ation".

3) If this works, what about the case where both windows are the same
application? I can't just use "name_of_applic ation", and I can't
just use a random session name since the various php files wouldn't
know the session name. I considered passing the session name
in the URL, but that could cause a problem if a page other than
the base page is bookmarked.

Any thoughts?

David
Jan 10 '06 #1
1 3442
>I use session_start() . When I open my web-based application in two windows
on the same system, there's a definite clash; I can't do two independent
sessions because the session variables are shared. I solved that
the easy way, by not opening two windows. But then I went on to write
more applications, and found that if I use the same variable names
(for session variables) in different applications I get that same
clash. That I couldn't live with. Now I do this;

session_name ("name_of_appli cation");
session_start ("");

which seems to protect the applications from each other. Questions:
session_name sets the name of the cookie used for the session ID.
1) Is this likely to really work? It seems to, but I could just be
testing it badly.
Yes, assuming cookies are turned on. If cookies are not turned on,
(and you're using trans_sid or manual methods to pass the session id
in the URL), you won't be able to have multiple sessions for different
applications simultaneously open (Unless you somehow manage to pass
*ALL* of the session IDs in the URL). Going to pages for APP B
will lose the session ID for APP A. If cookies are on, going to pages
for APP B should not lose the session ID for APP A.
2) Is this likely to cause nasty side-effects, like giving every
user (on different computers) access to the same named session?
No.
It looks OK so far, /var/lib/php4 still has random-looking
filenames; I was afraid the session files would be named
"name_of_applic ation".
No, but take a look at the cookies for that site on the browser.
3) If this works, what about the case where both windows are the same
application?
Under what circumstances do you need multiple instances of the same
application operating independently? Data for this might better
be passed around by GET or PUT. Oh, yes, the cookie database on the
browser may not be different for different windows of the same browser.
I can't just use "name_of_applic ation", and I can't
just use a random session name since the various php files wouldn't
know the session name. I considered passing the session name
in the URL, but that could cause a problem if a page other than
the base page is bookmarked.


Gordon L. Burditt
Jan 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3630
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow...
9
2444
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example at http://www.lamartin.com/dotnet/sessiontestset.aspx, were I set Session, Application and Cache variables on the first page and then on the second...
5
2193
by: ASP.Confused | last post by:
As you can tell from my previous posts on this issue...I'm really confused :-/ I have a few ASP.NET web applications on my web host's "https" server. Our web host has a single "bin" folder for me to toss my assemblies into. We keep loosing session state every few months. People have told me that my app could be running out of memory,...
13
2804
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or...
10
3489
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout...
10
2173
by: Li Pang | last post by:
Hi, I created a html page from which I give a link to another web site. The new site is opened in a new window. When I opened multiple windows, they all have the same SessionID. I want ot know how to open the windows with different sessionID. Thanks
10
2628
by: Nils Erik Dall | last post by:
Hi All I have a problem with my asp code on an iis 6.0 server on windows 2003 web. When I redirect between to asp pages on my web-site, where pageA is in a different virtual directory from pageB the session variables value a lost. I know that it is the session ID there increases. (New session). If I make the same call in the same virtual...
18
3422
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts...
26
3587
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user opens a new IE window with Ctrl-N or File-New-Window, BOTH WINDOWS SHARE THE SAME SESSION VARIABLES. This cannot be prevented.
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.