473,761 Members | 8,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_USE R"] or
$_SERVER["PHP_AUTH_U SER"] 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 1873
Henry Hartley scribbled something along the lines of:
I thought of just checking for $_SERVER["REMOTE_USE R"] or
$_SERVER["PHP_AUTH_U SER"] 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**********@w estat.com> wrote in message
news:2d******** *************** ***@posting.goo gle.com...
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_USE R"] or
$_SERVER["PHP_AUTH_U SER"] 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_U SER"] 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
7126
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 a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
0
1239
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 the regular policy. I've tried to use "satisfy any/all" in .htaccess file. AuthName "Me Only" AuthType Basic
3
1949
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 with custom user account database. And it shows clients a list of hyperlinks to content pages located in some separated subfolders. This application and content pages are entirely secured, so everyone must logon to the application. The application...
2
3839
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
4606
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
15527
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 check the password. The thing is I can't access the password attribute to compare with the user's password provided.
2
2854
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 folders that should show up are ones that allow them to modify sometime. I can list the directories/files just fine using directoryinfo/ fileinfo. But how can i tell if the current authenticated user has NTFS write/modify permissions on those...
2
1374
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 My.User.IsAuthenticated.ToString User.Identity.IsAuthenticated.ToString
2
1638
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
9531
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
9345
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
10115
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
9957
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
9905
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,...
1
7332
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
6609
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();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
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.