'."\n";
$msg .= 'alert(\''.__('You are not authorized to view this section').'\');'."\n";
$msg .= 'top.location.href = \''.SWB.'index.php?p=login\';'."\n";
$msg .= ''."\n";
// unset cookie admin flag
setcookie('admin_logged_in', false, time()-86400, SWB);
simbio_security::destroySessionCookie($msg, COOKIES_NAME, SWB.'admin', true);
}
// checking session checksum
$server_addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : gethostbyname($_SERVER['SERVER_NAME']));
$unauthorized = $_SESSION['checksum'] != md5($server_addr.SB.'admin');
if ($unauthorized) {
$msg = '
';
$msg .= __('You are not authorized to view this section');
$msg .= '
'."\n";
// unset cookie admin flag
setcookie('admin_logged_in', true, time()-86400, SWB);
simbio_security::destroySessionCookie($msg, COOKIES_NAME, SWB.'admin', true);
}
// check for session timeout
$curr_timestamp = time();
$timeout = ($curr_timestamp-$_SESSION['logintime']) >= $sysconf['session_timeout'];
if ($timeout) {
$msg = '';
$msg .= __('Your Login Session has already timeout!').'
Re-Login';
$msg .= '
'."\n";
// unset cookie admin flag
setcookie('admin_logged_in', true, time()-86400, SWB);
simbio_security::destroySessionCookie($msg, COOKIES_NAME, SWB.'admin', true);
} else {
// renew session logintime
$_SESSION['logintime'] = time();
}