Monitoring system - few specifications

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Consolas
Forum Newbie
Posts: 13
Joined: Wed Apr 09, 2008 7:07 pm

Monitoring system - few specifications

Post by Consolas »

Hello everyone

I want / need to implement a monitoring system into my website.

It should have the following specifications:
- how many times a user has logged on
- for how long has the user been logged on
- what pages whithin the site has the user visited
- how any times, if any, has the user changed password

I need to have a page monitoring has well:
- how many times has the page been visited

I was thinking of making this using classes, i think its the most appropriate. What i'm here to ask is what logic should i follow..

Should i have a main class called, for instance, monitoring and then 2 extends one for user_monitoring and another for page_monitoring?

Then on each extend i would have the functions that would insert into the database ( or update ) the information regarding the user / page. If a user entered a site, i would have a new user_monitoring("site_the_user_clicked") for instance, and on that class i would have an insert into a database of the site and user in question.


What do you think?

Thank you!!!

Ricardo
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: Monitoring system - few specifications

Post by Mordred »

I imagine it should be centered on the ++ idea. :lol: :twisted:

Seriously, you don't need much of a class hyerarchy - just a container for all the counters and hook functions to be called when the events in question happen. If it ever comes to "monitoring" something that doesn't fit the scheme, refactor accordingly. Don't overkill it from step 0.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Monitoring system - few specifications

Post by Ambush Commander »

First and foremost, you need an effective system of logging important events. "for how long has the user been logged on" is not an event per se; you can measure the logon, but it's exceedingly difficult to tell when a user has logged off. Somehow, however, the log-off event has to be called.

Other than that, a basic logging system would do well, with a few types of meta-data to make it easy to extract particular events from one user, and another class to crunch the data and turn it into something human readable; it would also be a good idea to cache those calculations and update the cache incrementally.
Post Reply