Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Http Auth Logging System

Status
Not open for further replies.

treyhunsucker

Programmer
May 16, 2006
60
US
Hello,

I am running a freebsd 6.2 with a mysql database with a php front end, and apache2 for web.

I setup the main directory to be secured by a htpasswd file and it works well.

What I would like to do is log what pages the user visits. I have done some research but I am not having any luck.

Can someone point me in the right direction?
 
You could write a script that logs the visit to the page and the user, and include it in every page.

It could log it into a DB, so you could then search by user, and display all the pages the user visited in a given period of time. or something like that.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Yes thats what I want to do, but I wanted to see if someone could point me in the right direction or show me a small example.
 
Well, you can get the authenticated user using the $_SERVER['PHP_AUTH_USER'] variable. so then its just a question of creating the insert statement or whatever with that user in the specified page.

but that will depend on how you want to handle the hits, either by increasing a counter on a per user/page basis.
Or if you are going to have all hist as independent rows, and then user a query to group them.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I would like for each page the user visits to record on a new row that they went to the page.

The only part that I really need now is that php code that will display what page they are on, so I can insert that into the database.

Thank you for all your help, It has me going in the right direction.

I am working late tonight so I am doing research now.
 
You can use the $_SERVER['SCRIPT_NAME'] to get the page they visited.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Good Morning, thank you for all your help.

I am going to insert these into a database for logging:

$_SERVER['PHP_AUTH_USER'];
$_SERVER['SCRIPT_NAME'];
$_SERVER['REMOTE_ADDR'];
date("m/d/y : H:i:s");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top