473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Logged in twice at the same time?

Without going into the details of my code: is it possible to have two
different users logged in at the same time?

I had one page where I found the username correctly set, and another
where it wasn't. (Just by checking <?= $_SERVER['PHP_AUTH_USER'] >? at
the top of each page.)

Wondering why it would be set for one page and not another (and as a
sanity check) I wrote another page which sends the basic auth headers
and so logged in again.

Now the first page shows my original username. All the other pages
(which used to show username at all) now show the second username. I can
freely switch between them too: it's very consistent. One page, user1.
All the rest: user2.

I'm really confused. I didn't think it was possible to be logged in as
two different users in the same browser against the same host at the
same time.

server: w2k, php 4.3.10, apache 1.3.24
client: both IE and FF.

--cd
Jul 17 '05 #1
3 2572
Are you using two IE or two FF browser windows on the same PC to test
this, or one IE and one FF?
I've never seen that work well, because the browser session can be
shared between both instances of the browser.

Does it do the same if you're in one IE and one FF window? Or even
browsers on sepparate PC's?

Jul 17 '05 #2
>Without going into the details of my code: is it possible to have two
different users logged in at the same time?
It depends on what kind of login you are talking about.
I had one page where I found the username correctly set, and another
where it wasn't. (Just by checking <?= $_SERVER['PHP_AUTH_USER'] >? at
the top of each page.) Wondering why it would be set for one page and not another (and as a
sanity check) I wrote another page which sends the basic auth headers
and so logged in again.
If you are dealing with a .htaccess basic login, and the authentication
realm (AuthName) is different, a browser can have lots of different
logins active (or not) on the same server. The browser uses the
authentication realm to determine which one to send.
Now the first page shows my original username. All the other pages
(which used to show username at all) now show the second username. I can
freely switch between them too: it's very consistent. One page, user1.
All the rest: user2.
Are the pages in different directories? While .htaccess can apply
different authentication to different pages, it's harder to do that
by accident in the same directory.
I'm really confused. I didn't think it was possible to be logged in as
two different users in the same browser against the same host at the
same time.


It's easy to have lots of different applications, each with their
own directory and different AuthName, and potentially different
password files, on the same server.

Gordon L. Burditt
Jul 17 '05 #3
> Are you using two IE or two FF browser windows on the same PC to test
this, or one IE and one FF?


It was one IE and one FF. Here's the behavior I saw:

IE, Page 1, PHP_AUTH_USER=apple
IE, Page 2, PHP_AUTH_USER=banana

FF, Page 1, PHP_AUTH_USER=apple
FF, Page 2, PHP_AUTH_USER=banana

IE on a completely different computer, Page 1, USER=apple
IE on a completely different computer, Page 2, USER=banana

At that point I ruled out the browser. Something was amiss server-side.

And I more or less figured it out, after about a hundred different
trial-and-error attempts and re-arranging call order. I won't say I
definitively figured it out, because this is still somewhat of a
mystery.

It seemed like every time "banana" showed up as the user, the http basic
auth header() calls were not being made. And if I could force the
header() call, then 'apple' would be logged in on every page. And once I
did that, I no longer had to send headers again: apple would stick.

The algorithm went like this:

if ("private" page) {
send_headers(); // force the http auth dialog
} elseif ("public" page) {
if (already been here) {
send_headers(); // does not pop up dialog, but does populate
PHP_AUTH_USER
} else {
// do nothing
}
}

Anyway, all seems to be working at this point, so I'm going to run with
it.

--cd
Jul 17 '05 #4

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

Similar topics

7
by: fr? | last post by:
Hi, i have a website , on wich users have to log in credentials are checked against mysql db some session vars are set during login for use somewhere else in the code. Is there a way to...
15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
8
by: Mike Thomas | last post by:
I have two clients now who want to have an Access 2000 & 2002 application running on NT Server 2000 do some file updating at night when nobody is in the office. I have used Windows scheduler to...
1
by: anonymous | last post by:
Hi all, I've been searching the way to achieve the following task. But no luck so far. I have a web site(main site), which requires authentication. This authentication is set at Windows...
6
by: omyek | last post by:
I'm trying to mimic the browsing of a webpage using an HttpWebRequest. I've had a lot of luck with it so far, including logging into pages, posting form data, and even collecting and using cookies....
8
by: Vince Varallo | last post by:
Hello All, I would like to display all logged on users on a web page. I store each user's name in a session varible, but I don't seem to be able to loop through a sessions collection to view...
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
1
by: oct08 | last post by:
Hi all, I'm trying to trouble shoot an issue where I am running an Access/VBA app, which grabs some data and puts it into a few text files. It usually takes 10 minutes to run (though after even a...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.