Home > Archive > PHP Language > October 2006 > Getting HTTP User
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| petehdd 2006-09-15, 3:57 am |
| Hi,
Okay I have basic HTTP Authentication using .htaccess and .htpasswd files...
Is it possible for PHP to somehow get the Username of the currently logged
in user?
I simply want to echo the username once they have been authenticated...
Thanks
Peter
petemod [AT] gmail [dot] com
| |
| Mumia W. 2006-09-15, 3:57 am |
| On 09/15/2006 03:03 AM, petehdd wrote:
> Hi,
>
> Okay I have basic HTTP Authentication using .htaccess and .htpasswd files...
> Is it possible for PHP to somehow get the Username of the currently logged
> in user?
> I simply want to echo the username once they have been authenticated...
>
> Thanks
>
> Peter
>
> petemod [AT] gmail [dot] com
>
>
Here is an example:
http://www.php.net/manual/en/features.http-auth.php
After a successful login, you can store the user-name in a
session variable.
| |
| Carl Vondrick 2006-10-07, 9:57 pm |
| petehdd wrote:
> Okay I have basic HTTP Authentication using .htaccess and .htpasswd files...
> Is it possible for PHP to somehow get the Username of the currently logged
> in user?
> I simply want to echo the username once they have been authenticated...
Hey,
Check out this tutorial here:
http://youngcoders.com/showthread.php?p=97801#post97801
--
Carl Vondrick
www.YoungCoders.com -- Forum for the younger, next generation
programmers.
| |
|
| On Fri, 15 Sep 2006 18:03:28 +1000, "petehdd" <ptrw@ptrw.com> wrote:
>Hi,
>
>Okay I have basic HTTP Authentication using .htaccess and .htpasswd files...
>Is it possible for PHP to somehow get the Username of the currently logged
>in user?
>I simply want to echo the username once they have been authenticated...
>
>Thanks
>
>Peter
>
>petemod [AT] gmail [dot] com
>
I don't think it's possible to do this with .htaccess method
You could build your one custom login screen with html forms and php. The users could be kept in
mysql db if there are many, or this information could be kept in a flat file.
Once a user provides a correct username/password, the username could be set into a session or a
cookie. Then whatever page they visit that information is retreived to see if they have permission
to visit the page and/or display that info on the screen.
| |
| Colin McKinnon 2006-10-08, 6:58 pm |
| Gleep wrote:
> On Fri, 15 Sep 2006 18:03:28 +1000, "petehdd" <ptrw@ptrw.com> wrote:
>
>
>
> I don't think it's possible to do this with .htaccess method
>
Yes it is.
RTFM - there's a whole chapter on it: http://uk.php.net/features.http-auth
C.
|
|
|
|
|