# This code is only available under the GNU General Public License version 2 # Copyright(C) 2008 Litesim Ltd def session_prefix(): formdata = web.input() web.query('delete from session where SessionLastActivity < DATE_SUB(NOW(),INTERVAL 90 MINUTE);') session = web.cookies() if session.has_key('ls_session'): session_data = web.select('session',where=web.db.sqlwhere({'SessionID':session.ls_session})) if session_data.__len__()>0: if stuff.session_manager.valid_session(session.ls_session): web.update('session',where=web.db.sqlwhere({'SessionID':session.ls_session}),SessionLastActivity=time.strftime('%Y-%m-%d %H:%M:%S')) account_id=session_data[0].SessionAccount user_account = web.select('account',where=web.db.sqlwhere({'accountID':account_id})) user_data = user_account[0] if user_account.__len__()==1: first = user_data.accountFirstName last = user_data.accountLastName return "

Hello " + first + " " + last + "

" else: web.setcookie('ls_session','',expires=1,domain='litesim.com') if not formdata.has_key('logout'): return '
Your session appears to have timed out!
You should probably login again
'