Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

username from htaccess/authentication

Posted on 2004-09-16
3
Medium Priority
?
254 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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month20 days, 18 hours left to enroll

810 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