There is a good tutorial fro writing mambots at joomla.org. Also, you should familiarize yourself with PHP sessions. You can use $my variable to check if the user is registered, and php time functions to see when a session has been started.
If you are not familiar with PHP, hiring a developer to do this would be the best thing. This is probably 10 lines of code, or so, o it should not be too expensive at
www.joomlancers.com
-Mikko