Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI and Apache authentication

         

runner

2:44 pm on Aug 28, 2006 (gmt 0)

10+ Year Member



My web site uses basic apache authentication to protect some pages in a secure directory. I'd like to know if there is some way my CGI script can check to see if the current user has already logged in or not. (to access the secured pages)

I thought there was some sort of "token" that was placed in the header of a request to show the user was authenticated but I don't see a variable for this that I can use in my script.

I've been googling for a solution to this but I must not be using the correct terminology.

majorbiff

8:53 am on Aug 29, 2006 (gmt 0)

10+ Year Member



If the user has correctly authenticated themselves, the username is placed into the 'REMOTE_USER' environment variable.
You should be able to access it by doing something like this:

my $username = $ENV{REMOTE_USER};

runner

8:02 pm on Aug 29, 2006 (gmt 0)

10+ Year Member



Thank you for the information, this helps. I ended up buying an Apache Server reference book that had a more complete listing of variables.