# This code is only available under the GNU General Public License version 2# Copyright(C) 2008 Litesim Ltddef 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 "<p style=\"font-size: x-small;\">Hello " + first + " " + last + "</p>" else: web.setcookie('ls_session','',expires=1,domain='litesim.com') if not formdata.has_key('logout'): return '<div class="globalmsg">Your session appears to have timed out!<br/>You should probably login again</div>'