Solved

username from htaccess/authentication

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cpanel file manager 8 41
how to use a switch statement with heredoc 11 33
mysqli_connect error on wamp but not on remote server 8 37
Email called spam 5 36
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 …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

856 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