6 August 2010 at 8:49pm
I have a SilverStripe site where users have to pay a subscription fee in order to be able to view the site content.
I would like to log user's IP addresses when they access the site, so that in future I can detect if a user is logging in for different IP addresses at the same time, which would be an indication this user has given their login details to another party.
What is the best way to go about doing this? I presume I have 2 choices, log IP upon login or upon visiting, I believe "LastVisited" updates every time a user changes pages, so would that add too much overhead if I was logging their IP each time too?
Either way, how can I perform an action upon "login" and upon "visited"?
8 August 2010 at 6:32am
hmmm I'd be very interested what you end up with... my suggestions would be....
1) to decorate/use custom class the Member (I can't remember which I've used at the moment) then use an onAfterWrite and note when 'LastVisited' changed (http://api.silverstripe.org/2.4/sapphire/model/DataObject.html#methodgetChangedFields).
2) to add something like this to Page.ss
<% if CurrentMember %>$MyMemberIPLoggerFunction<% end_if %>