Solved

username from htaccess/authentication

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calculate values in an array 18 33
only allow numbers with preg match 4 25
WordPress syntax 2 25
array_values - reorder after unset? 5 9
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

914 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

19 Experts available now in Live!

Get 1:1 Help Now