htpasswd logging or script to log

imported_KuJaX

Platinum Member
May 29, 2004
2,428
0
0
Hello Everyone!

I have a .htpasswd setup with username:encryptedpassword format. Simply put, if someone tries to access members_only.php then it will immediately prompt them for their username and password (which i manually put into the .htpasswd and e-mailed to them).

I would like to log each and everytime someone logs in, into a log file. For example, if I gave out usernames "johndoe" and "janedoe" to two different people, and "johndoe" logs in today at 10:00am then the log would look something like this:


johndoe 8/3/2006 10:00am


Lets say 5 minutes later "janedoe" logs into the page. The log file would then look like this:


johndoe 8/3/2006 10:00am
janedoe 8/3/2006 10:05am


and then if johndoe logs in a week later (with no one logging in in that week's time)


johndoe 8/3/2006 10:00am
janedoe 8/3/2006 10:05am
johndoe 8/10/2006 10:00am


I hope you understand what I am after. If someone can provide some assistance on having a log file of each time a username logs in, that would be absolutely fantastic and would be greatly appreciated. Thanks,
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
the only way i know how is to switch to a session based system and a user database and a log database

although your appache logs probably show the ht logins, you could probably write a script to filter them out of the server log
 

imported_KuJaX

Platinum Member
May 29, 2004
2,428
0
0
Originally posted by: troytime
the only way i know how is to switch to a session based system and a user database and a log database

although your appache logs probably show the ht logins, you could probably write a script to filter them out of the server log

Yeah I believe that the apache logs do grab this, but I don't know how or where to look for a script to filter out the server log.

Any specific session based system and user database that is simple and can do what I need (and free!) :)
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
there's a ton of em out there i'm sure

i have several that i use, but they're so hacked up and specialized it'd take a lot of work just to pass the code along

here's one from digg