What's your background data structure like? Do you have a table of distinct user names and session logs etc? Can you attach a copy of your app? I think I would look at breaking it down into more than one step so you could look at counting the number of active sessions in the script perhaps. I'd need to see the file to have a better go at it ... quite difficult with no view of the data structure.
Also ... are you expecting consecutive login over 15 calendar days or working days?