Changes

Pandora - Sample - Validate User Session

1,124 bytes added, 19:56, 23 July 2010
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.


<pre>
</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;
}
</pre>

[[Category:Pandora]]
0
edits