Username of currently logged on user?

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, ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-07-2007
Simon Harris
 
Posts: n/a
Default Username of currently logged on user?

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!


Reply With Quote
  #2 (permalink)  
Old 03-07-2007
Rik
 
Posts: n/a
Default Re: Username of currently logged on user?

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
Reply With Quote
  #3 (permalink)  
Old 03-08-2007
Simon Harris
 
Posts: n/a
Default Re: Username of currently logged on user?

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!


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:16 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0