1 // login.php makes sure the session ID captured here is different for each
2 // new login. We maintain it here because most browsers do not have separate
3 // cookie storage for different top-level windows. This function should be
4 // called just prior to invoking any server script that requires correct
5 // session data. onclick="top.restoreSession()" usually does the job.
7 var oemr_session_name
= '<?php echo session_name(); ?>';
8 var oemr_session_id
= '<?php echo session_id(); ?>';
9 var oemr_dialog_close_msg
= '<?php echo xl('OK to close this other popup window?
'); ?>';
11 function restoreSession() {
12 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
13 var ca
= document
.cookie
.split('; ');
14 for (var i
= 0; i
< ca
.length
; ++i
) {
15 var c
= ca
[i
].split('=');
16 if (c
[0] == oemr_session_name
&& c
[1] != oemr_session_id
) {
17 <?php
if ($GLOBALS['restore_sessions'] == 2) { ?
>
18 alert('Changing session ID from\n"' + c
[1] +
'" to\n"' + oemr_session_id +
'"');
20 document
.cookie
= oemr_session_name +
'=' + oemr_session_id +
'; path=/';