Solved

username from htaccess/authentication

Posted on 2004-09-16
3
242 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

770 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