This is a discussion on Username of currently logged on user? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi All, I am trying to get the username of the currently logged on user. - The protected directory is /admin, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi All,
I am trying to get the username of the currently logged on user. - The protected directory is /admin, within which is .htaccess as follows AuthName "mysite.co.uk - Admin" AuthType Basic AuthUserFile /usr/local/psa/home/vhosts/mysite.co.uk/httpdocs/.htpasswd require valid-user - In the root of my site, is the .htpasswd file, containing username/password pairs - When I go to /admin, I am prompted for credentials. I enter these and am allowed in - On /admin/index.php I have tried the following: $authUser = $_SERVER['LOGON_USER']; and... $authUser = $_SERVER['PHP_AUTH_USER']; Both return an empty string/null when printed to the page Any help would be much appreciated. Thanks, Simon. -- -- * Please reply to group for the benefit of all * Found the answer to your own question? Post it! * Get a useful reply to one of your posts?...post an answer to another one * Search first, post later : http://www.google.co.uk/groups * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat! -------------------------------------------------------------------------------- I am using the free version of SPAMfighter for private users. It has removed 5057 spam emails to date. Paying users do not have this message in their emails. Try SPAMfighter for free now! |
|
|||
|
Simon Harris <too-much-spam@makes-you-fat.com> wrote:
> Hi All, > > I am trying to get the username of the currently logged on user. > > - The protected directory is /admin, within which is .htaccess as follows > AuthName "mysite.co.uk - Admin" > AuthType Basic > AuthUserFile /usr/local/psa/home/vhosts/mysite.co.uk/httpdocs/.htpasswd > require valid-user > - On /admin/index.php I have tried the following: > > $authUser = $_SERVER['LOGON_USER']; > and... > $authUser = $_SERVER['PHP_AUTH_USER']; > > Both return an empty string/null when printed to the page Fast & simple: print_r($_SERVER); and see for yourself. -- Rik Wasmus Posted on Usenet, not any forum you might see this in. Ask Smart Questions: http://tinyurl.com/anel |
|
|||
|
Fast & simple:
print_r($_SERVER); and see for yourself. Rik - Thanks! It was REMOTE_USER. Simon. -------------------------------------------------------------------------------- I am using the free version of SPAMfighter for private users. It has removed 5088 spam emails to date. Paying users do not have this message in their emails. Try SPAMfighter for free now! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|