473,396 Members | 1,996 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,396 software developers and data experts.

Check if User Has Authenticated

I've got a web site that has a mix of public and private sections.
When you first come to the site, the final option on the menu is
"Private" which forces an authentication and then gives you an
expanded menu that includes all the private sections of the site.
What I'd like to do is give users the proper menu ("public only" or
"public and private") depending on whether they have authenticated
with the site.

I thought of just checking for $_SERVER["REMOTE_USER"] or
$_SERVER["PHP_AUTH_USER"] but if you are on a public page, those don't
exist whether or not you have authenticated with the private sections.
I was hoping not to have to deal with sessions or cookies but is that
the only option I have? Or is there some value somewhere that will
tell me that a user has authenticated and that is available (to PHP)
even in the public areas?

--
Henry
Jul 17 '05 #1
2 1851
Henry Hartley scribbled something along the lines of:
I thought of just checking for $_SERVER["REMOTE_USER"] or
$_SERVER["PHP_AUTH_USER"] but if you are on a public page, those don't
exist whether or not you have authenticated with the private sections.
I was hoping not to have to deal with sessions or cookies but is that
the only option I have? Or is there some value somewhere that will
tell me that a user has authenticated and that is available (to PHP)
even in the public areas?


Sessions.
http://www.php.net/session

--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/
Jul 17 '05 #2
"Henry Hartley" <he**********@westat.com> wrote in message
news:2d**************************@posting.google.c om...
I've got a web site that has a mix of public and private sections.
When you first come to the site, the final option on the menu is
"Private" which forces an authentication and then gives you an
expanded menu that includes all the private sections of the site.
What I'd like to do is give users the proper menu ("public only" or
"public and private") depending on whether they have authenticated
with the site.

I thought of just checking for $_SERVER["REMOTE_USER"] or
$_SERVER["PHP_AUTH_USER"] but if you are on a public page, those don't
exist whether or not you have authenticated with the private sections.
I was hoping not to have to deal with sessions or cookies but is that
the only option I have? Or is there some value somewhere that will
tell me that a user has authenticated and that is available (to PHP)
even in the public areas?


You will get $_SERVER["PHP_AUTH_USER"] in your public pages once the user
has entered his username/password. The browser doesn't just send the
authentication info to the page which generated the 401 Unauthorized
response. It sends it for all files at the same directory level and below.
Jul 17 '05 #3

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

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
0
by: bunnytail | last post by:
hi all, I wonder if its possible in Apache authentication scheme, to have a special user that will be authenticated without password in interanl network, while other users still have to follow...
3
by: TK | last post by:
Excuse me for multiple posting because I've posted this message to aspnet.security NG but have not got any response yet. I'm building an ASP.NET application works in Forms Authentication mode...
2
by: Dan | last post by:
hi ng, i have a problem with windows authentification. i want to forward every user who 1. is not authorized 2. or could not be authenticated to a login page -------------------
3
by: shapper | last post by:
Hello, How to I check if a user is authenticated and if it is what is its role? I am using Asp.Net 2.0 and forms authentication. Thanks, Miguel
9
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
2
by: Paul Lemke | last post by:
Hello, I currently have an application that uses authenticates users via NTLM. I would like to provide a user a directory listing of a folder. Everyone has read access to the folder, but the only...
2
by: shapper | last post by:
Hello, I need to check if the current user is authenticated and get its profile. For authentication checking I got the following options: Request.IsAuthenticated.ToString...
2
by: shapper | last post by:
Hello, How can I check if a user is authenticated? I am using ASP.NET Membership forms authentication. Thanks, Miguel
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
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,...
0
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...
0
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...
0
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...

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.