Solved

username from htaccess/authentication

Posted on 2004-09-16
3
237 Views
Last Modified: 2008-03-06
Hello there,

I am using htaccess/htpasswd to create a 'secure' area on my site, now can I pass somthing to a php script on login so I can tell who has logged in.

Example,

they goto the members area
they get the standard username/password dialog which they enter there details into
they then get passed to the secure area at the top it says - 'Welcome back USER
Follow what I mean? So I don't want php to handle the login or passwords or anything, just want to know if there is a way to display the name of who's loged in, and maybe even write a login file saying
USERNAME - Login date
so I can look at  it and see when users have logged in.

I know it would be simpler to use php to handle everything, but I am happy with apache / htaccess/htpasswd handling that for now.

Cheers
Nick
0
Comment
Question by:wildzero
3 Comments
 
LVL 6

Accepted Solution

by:
peyox earned 125 total points
ID: 12081029
Check which one of below works for you:

<?
   echo "\$_SERVER[REMOTE_USER]="; echo $_SERVER["REMOTE_USER"]."<br>";
   echo "\$PHP_AUTH_USER="; echo $PHP_AUTH_USER."<br>";
   echo "\$REMOTE_USER="; echo $REMOTE_USER;
?>

Cheers,
Piotr Szwajkowski
0
 
LVL 6

Expert Comment

by:merwetta1
ID: 12081532
wildzero,

i don't think your question is really a PHP question. you should post a question asking if Apache creates a log of authorized accesses at the Apache forum.

http://www.experts-exchange.com/Web/Web_Servers/Apache/

you're right that letting PHP handle authorization would be better.

hope you find the log your looking for.
0
 
LVL 10

Author Comment

by:wildzero
ID: 12088666
peyox - Perfect :D
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now