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(); ?>';
10 function restoreSession() {
11 <?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 document
.cookie
= oemr_session_name +
'=' + oemr_session_id +
'; path=/';
18 <?php
if (strcasecmp($GLOBALS['restore_sessions'], 'debug') == 0) { ?
>
19 alert('Session ID changed from\n"' + c
[1] +
'" to\n"' + oemr_session_id +
'"');