Pandora - Sample - Validate User Session
From SmartWiki
Revision as of 14:56, 23 July 2010 by Cameron (talk | contribs) (Created page with 'This procedure can be used to ensure a valid user session still exists. If the session has timed-out it will give the user a chance to open a new tab and re-authenticate to the …')
This procedure can be used to ensure a valid user session still exists.
If the session has timed-out it will give the user a chance to open a new tab and re-authenticate to the SmartSimple server rather than losing their work.
- Because the confirmusersession function is called in the savefunc and returns false if it fails the page will not be submitted to the server and the page will not be refreshed.
</script> <script type="text/javascript" language="javaScript" src="/Ajax/uta/uta.js"></SCRIPT> <script language="javaScript"> function savefunc(frm){ if (!confirmusersession('@me.userid@')) {alert('You are no longer logged in, or your login session has been replaced by another user account\n\nPlease open a new window or tab, log back in and re-submit this form');return false;} return true; } function confirmusersession(initialuserid){ ss_developer_key="123456-7qY6n7hLlCsdlhasdlhkdhklgFk="; var rs=session_getuser(false,'','userid'); currentuserid=rs.getfieldbyname(1,"userid"); if(currentuserid!=initialuserid) return false; return true; }