@mwindey
These codes will use existing session.
Btw. few months ago we have also issue with sessions - they expired within several seconds/minutes together with cookies. After spending hours and hours, we asked hosting to move on different server and problem disappeared. Even hosting tech guys were not able to identify what was issue.
I strongly recommend to play with oc-includes/osclass/core/Session.php
public static function newInstance()
{
if (!self::$instance instanceof self) {
self::$instance = new self;
}
return self::$instance;
}
public function session_start()
{
$currentCookieParams = session_get_cookie_params();
if (defined('COOKIE_DOMAIN')) {
$currentCookieParams[ 'domain' ] = COOKIE_DOMAIN;
}
if ( isset($_SERVER['HTTPS']) ) {
$currentCookieParams["secure"] = true;
}
session_set_cookie_params(
$currentCookieParams[ 'lifetime' ],
$currentCookieParams[ 'path' ],
$currentCookieParams[ 'domain' ],
$currentCookieParams[ 'secure' ],
true
);
if (!isset($_SESSION)) {
session_name('osclass');
if (!$this->_session_start()) {
session_id(uniqid('', true));
session_start();
session_regenerate_id();
}
}
$this->session = $_SESSION;
if ($this->_get('messages') == '') {
$this->_set('messages', array());
}
if ($this->_get('keepForm') == '') {
$this->_set('keepForm', array());
}
if ($this->_get('form') == '') {
$this->_set('form', array());
}
}
This is only place where osclass should be able to create session.
session_id(uniqid('', true));
session_start();
session_regenerate_id();