473,804 Members | 3,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sessions mixing

Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.

Thanks for any help.

-- E. Will // rakaur @ malkier
Jul 17 '05 #1
9 3061
E. Will wrote:
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.

Thanks for any help.

-- E. Will // rakaur @ malkier


Strange behavior indeed! Are you generating your own session ID's? Make
sure your session ID's are truly unique; that is, you are not generating
ID's already in use by the system. Are you storing your session ID's in
a database? If so, check to see that you are retrieving the correct
session information. Are the two users connecting to the same
application via the same browser on the same machine? If so, that could
be the culprit right there.

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan
Jul 17 '05 #2
Amir Khawaja wrote:
E. Will wrote:
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.

Thanks for any help.

-- E. Will // rakaur @ malkier

Strange behavior indeed! Are you generating your own session ID's? Make
sure your session ID's are truly unique; that is, you are not generating
ID's already in use by the system. Are you storing your session ID's in
a database? If so, check to see that you are retrieving the correct
session information. Are the two users connecting to the same
application via the same browser on the same machine? If so, that could
be the culprit right there.


I simply use session_start() and the rest is done via $_SESSION (or in
some cases $HTTP_SESSION_V ARS). The session IDs should be generated
uniquely by PHP. The sessions are being stored in the default directory.
The two users was just an example. One site actually had about 40
users from varying geographic locations using varying
browsers/platforms/etc and they were all swapping sessions.

- E. Will
Jul 17 '05 #3
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.


It never happened to me, even in 10,000 hits per hour like sites.
Questions like this should give some idea about INI settings (at least
for the session )... I guess, the session.entropy _length is shorter
than the default.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4
R. Rajesh Jeba Anbiah wrote:
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.

It never happened to me, even in 10,000 hits per hour like sites.
Questions like this should give some idea about INI settings (at least
for the session )... I guess, the session.entropy _length is shorter
than the default.

It's all default.
Jul 17 '05 #5
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
R. Rajesh Jeba Anbiah wrote:
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing.'' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(including the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.

It never happened to me, even in 10,000 hits per hour like sites.
Questions like this should give some idea about INI settings (at least
for the session )... I guess, the session.entropy _length is shorter
than the default.


It's all default.

Then, it sounds like a hoax. You haven't said anything about the
version of your PHP... You also said, you've faced similar problem
before(with various versions!!) ?? Yet, I haven't heard such problem.
Yet, I have faced clustering of session alone, which can be solved
with custom session handler.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6
R. Rajesh Jeba Anbiah wrote:
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
R. Rajesh Jeba Anbiah wrote:
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
Hello world,

Myself and a few friends have been experiencing the same problem. When
using sessions in PHP for ``logins'' we experience the sessions
``mixing. '' To say, one user logs in as ``foo,'' another user logs in as
``bar.'' User ``foo'' refreshes to find himself now logged in as
``bar'' or not logged in at all. This has happened on several different
scripts running on several different hosts using several PHP versions
(includin g the latest). I've been able to overcome it once in the past,
though I can't remember how and if the same method would have worked I
probably would have found it by now.
It never happened to me, even in 10,000 hits per hour like sites.
Questions like this should give some idea about INI settings (at least
for the session )... I guess, the session.entropy _length is shorter
than the default.

It's all default.

Then, it sounds like a hoax. You haven't said anything about the
version of your PHP... You also said, you've faced similar problem
before(with various versions!!) ?? Yet, I haven't heard such problem.
Yet, I have faced clustering of session alone, which can be solved
with custom session handler.

Yes that's right, I'm faking it. Good call.

I mentioned the PHP versions in the first post. It's happened to me and
to two other friends on varying occasions. Sometimes it happens,
sometimes it doesn't. It appears to be a flat-out bug to me. There's no
pattern whatsoever. If the only conclusion you can come to is ``he's
lying'' then you're probably mentally ill. I have better things to do
than to sift through seventy messages a day on a news group to see who
responded to a made-up bug.

If you need proof I'll put it on a public page. In the mean time, if you
have nothing to say other than calling me a liar don't bother responding.
Jul 17 '05 #7
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
>Hello world,
>
>Myself and a few friends have been experiencing the same problem. When
>using sessions in PHP for ``logins'' we experience the sessions
>``mixing. '' To say, one user logs in as ``foo,'' another user logs in as
> ``bar.'' User ``foo'' refreshes to find himself now logged in as
>``bar'' or not logged in at all. This has happened on several different
>scripts running on several different hosts using several PHP versions
>(includin g the latest). I've been able to overcome it once in the past,
>though I can't remember how and if the same method would have worked I
>probably would have found it by now.
It never happened to me, even in 10,000 hits per hour like sites.
Questions like this should give some idea about INI settings (at least
for the session )... I guess, the session.entropy _length is shorter
than the default.
It's all default.


Then, it sounds like a hoax. You haven't said anything about the
version of your PHP... You also said, you've faced similar problem
before(with various versions!!) ?? Yet, I haven't heard such problem.
Yet, I have faced clustering of session alone, which can be solved
with custom session handler.

Yes that's right, I'm faking it. Good call.

I mentioned the PHP versions in the first post.
Hmmm... I couldn't see. Could you?
It's happened to me and
to two other friends on varying occasions. Sometimes it happens,
sometimes it doesn't. It appears to be a flat-out bug to me. There's no
pattern whatsoever. If the only conclusion you can come to is ``he's
lying'' then you're probably mentally ill.
Ok.
I have better things to do
than to sift through seventy messages a day on a news group to see who
responded to a made-up bug.

If you need proof I'll put it on a public page.
May be you can. But, you said that you've previously faced similar
problem and solved it. So, I think, you can better check your previous
codes to see how you've done. Anyway, you please report the bug (with
more info like, PHP version, OS, INI settings, etc) to PHP dev team.
In the mean time, if you
have nothing to say other than calling me a liar don't bother responding.


Ok.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #8
"E. Will" <ra****@malkier .net> wrote in message news:<10******* ******@corp.sup ernews.com>...
<snip>
I mentioned the PHP versions in the first post. It's happened to me and
to two other friends on varying occasions. Sometimes it happens,
sometimes it doesn't. It appears to be a flat-out bug to me. There's no
pattern whatsoever. If the only conclusion you can come to is ``he's
lying'' then you're probably mentally ill. I have better things to do
than to sift through seventy messages a day on a news group to see who
responded to a made-up bug.

If you need proof I'll put it on a public page. In the mean time, if you
have nothing to say other than calling me a liar don't bother responding.


I'd thought that you'll be providing more info about your code.
Unfortunately, in this c.l.p, most of the visitors present the vague
questions but expect the best answer. In your case, you didn't mention
about your login system, version, etc.

1. I still believe, there is no bug in PHP session. The problem might
be in your installation or your settings. Or someone else is hacking
the system. You should note that, you can pass someone's session_id to
see other's session variables (security issues). In this case, you
need to find better/secure login system.

2. Increase the session.entropy _length to 32. It may _sometimes_ help
you.

3. Find a better login system (no idea, how you do!!). The logic is:
save the session_id of the user in user table while he logins to the
site. And check the current session_id (of the page) with the one
present in the DB on "every pages". For more info on this stuff, see
Martin's login script/tutorial (<http://martin.f2o.org/php/login>)

HTH.
--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #9
I am not an expert on sessions, but have you tried storing the IP
address along with each session-id and then checking the IP against
the session-id. I know that proxy servers, etc can cause this to fail
because some user's IP address changes during a session, but it may
illuminate the issue a little more.

Viking
On Wed, 28 Jan 2004 17:09:18 -0600, "E. Will" <ra****@malkier .net>
wrote:

I simply use session_start() and the rest is done via $_SESSION (or in
some cases $HTTP_SESSION_V ARS). The session IDs should be generated
uniquely by PHP. The sessions are being stored in the default directory.
The two users was just an example. One site actually had about 40
users from varying geographic locations using varying
browsers/platforms/etc and they were all swapping sessions.

- E. Will


Jul 17 '05 #10

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

Similar topics

13
12055
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location on the server (in our own accounts on the same machine). When I am testing both versions of our program using the same browser (IE on Windows or Konqueror on Linux) the session variables will mix up and only the latest selection or options will...
4
31202
by: john | last post by:
How do u guys handle multiple sessions?? i.e, opening different browser windows by running iexplore.exe or clicking IE icons and opening the application. My sessions are mixing up. what i mean is suppose i log in my site using username "test". At this time I set $_SESSION="test". And I use $_SESSION inside my application to print the username. Now if I open another browser & log in with "another test" the session
3
2484
by: Maxime Ducharme | last post by:
Hi group We have a problem with sessions in one of our sites. Sessions are used to store login info & some other infos (no objects are stored in sessions). We are using Windows 2000 Server (IIS 5.0) with ASP 3.0 (no .NET on this site). Sometime, data in session is emptied. I say "sometime"
0
1033
by: BluDog | last post by:
Hi I am trying to monitor the users that have active sessions on a small intranet (only about 20 users). I log sessions in and out in an SQL database, what i want is a page that displays the current users. I can do this easily by refreshing the page, but i was wondering if anyone had any idea of how to acheive this without invoking an entire page refresh.
1
8246
by: Praveen_db2 | last post by:
Hi All I came across a small doubt. Suppose I have Max Connections parameter set to 200. There are now 200 connections to the database. Out of these 200 connections 50 are idle. What will happen if a new user tries to connect to the database? Whether he will receive error about MAXCONNECTIONS exceeded or he will be allotted a connection as 50 agents are idle now? Also how to kill those idle sessions or connections to make way for active...
28
3107
by: ziman137 | last post by:
Hello all, I have a question and am seeking for some advice. I am currently working to implement an algorithmic library. Because the performance is the most important factor in later applications, I decide to write it in C instead of C++. However, I thought it might be convenient to use some C++ code at some misc places. I'm aware that, I could always use the C++ compiler to get it work.
3
2737
by: Jon Slaughter | last post by:
Any pitfalls or stuff I need to worry about when working with sessions? I want to write a log file and hit counter along with a login interface and I'm trying to learn this stuff. http://us.php.net/session Just wondering if theres anything that I need to keep in mind while I work on it? Thanks,
3
28335
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every developer needs to know how to use. This article explains the basics of PHP Sessions. Assumptions: Basic PHP knowledge is required (variables, arrays and such) HTML Forms. What are Sessions? Sessions are a way of storing data. When developing...
26
7950
by: Bookham Measures | last post by:
Hello We are planning to set-up a load balanced web environment. Accordingly, we are going to change the session management on our website from the classic ASP Session State and session variables, to a database method. Does any one have any pointers as to how I might approach this, so that I can have the same sort of functionality the ASP sessions give without having to create database columns for each session variable I wish to...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4301
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

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.