We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31782
    • 103 Posts
    Negotiations with the manager of my hosting to no avail. He believes that this is a problem of my CMS. Sottwell, please tell me what and how to modify the code to solve this problem? I tried to just create a folder ’sessions’ on my site - and call the function session_save_path, but it did not help.


    // start cms session
    if(!function_exists('startCMSSession')) {
    	function startCMSSession(){
    		global $site_sessionname;
    		session_name($site_sessionname);
    //session_save_path('/home/mysite/vg/sessions');
    		session_start();
    		$cookieExpiration= 0;
            if (isset ($_SESSION['mgrValidated']) || isset ($_SESSION['webValidated'])) {
                $contextKey= isset ($_SESSION['mgrValidated']) ? 'mgr' : 'web';
                if (isset ($_SESSION['modx.' . $contextKey . '.session.cookie.lifetime']) && is_numeric($_SESSION['modx.' . $contextKey . '.session.cookie.lifetime'])) {
                    $cookieLifetime= intval($_SESSION['modx.' . $contextKey . '.session.cookie.lifetime']);
                }
                if ($cookieLifetime) {
                    $cookieExpiration= time() + $cookieLifetime;
                }
    			if (!isset($_SESSION['modx.session.created.time'])) {
    			  $_SESSION['modx.session.created.time'] = time();
    			}
            }
    		setcookie(session_name(), session_id(), $cookieExpiration, MODX_BASE_URL.'/sessions');
    	}
    }