Forum Moderators: phranque

Message Too Old, No Replies

How to pass username from htaccess

Help please

         

rob_ptb

12:38 am on Mar 17, 2004 (gmt 0)

10+ Year Member



I am using htaccess and htpasswd to protect my directories. What I would like to do is have it so if someone logs in as "JoeSchmoe" with password "whatever" once they are validated and brought to the page it says, "Welcome JoeSchmoe".

So, how do I extract the username they used to log in from the htaccess/htpasswd process and place it in a variable such as a cookie or pass it to my page in form data such as a post? I am using asp pages for the most part.

jetboy_70

1:36 am on Mar 17, 2004 (gmt 0)

10+ Year Member



Never needed to do this (so take these comments with a pinch of salt) but I don't think you can using client side code. Either use CGI or something like PHP.

In PHP,

$_SERVER['PHP_AUTH_USER'] or
$_SERVER['REMOTE_USER']

*may* be good places to look.

rob_ptb

2:29 am on Mar 17, 2004 (gmt 0)

10+ Year Member



Using the Remote_User call did it. I cant believe it was that simple. I was way over-engineering it. Thank you so much!