Skip to content
Snippets Groups Projects
Commit 7f3411ed authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #709 from greezybacon/issue/localhost-login


Fix cookie domain for localhost

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 2f5a9e89 8e72e521
No related branches found
No related tags found
No related merge requests found
...@@ -25,19 +25,32 @@ class osTicketSession { ...@@ -25,19 +25,32 @@ class osTicketSession {
if(!$this->ttl) if(!$this->ttl)
$this->ttl=SESSION_TTL; $this->ttl=SESSION_TTL;
if (!defined('DISABLE_SESSION') && !OsticketConfig::getDBVersion()) { if (defined('DISABLE_SESSION') || OsticketConfig::getDBVersion())
//Set handlers. return;
session_set_save_handler(
array(&$this, 'open'), # Cookies
array(&$this, 'close'), // Avoid setting a cookie domain without a dot, thanks
array(&$this, 'read'), // http://stackoverflow.com/a/1188145
array(&$this, 'write'), $domain = null;
array(&$this, 'destroy'), if (isset($_SERVER['HTTP_HOST'])
array(&$this, 'gc') && strpos($_SERVER['HTTP_HOST'], '.') !== false
); && !Validator::is_ip($_SERVER['HTTP_HOST']))
//Forced cleanup. $domain = $_SERVER['HTTP_HOST'];
register_shutdown_function('session_write_close'); session_set_cookie_params(86400, ROOT_PATH, $domain,
} osTicket::is_https());
//Set handlers.
session_set_save_handler(
array(&$this, 'open'),
array(&$this, 'close'),
array(&$this, 'read'),
array(&$this, 'write'),
array(&$this, 'destroy'),
array(&$this, 'gc')
);
//Forced cleanup.
register_shutdown_function('session_write_close');
//Start the session. //Start the session.
session_name('OSTSESSID'); session_name('OSTSESSID');
session_start(); session_start();
......
...@@ -130,10 +130,6 @@ ...@@ -130,10 +130,6 @@
else else
require(INCLUDE_DIR.'mysql.php'); require(INCLUDE_DIR.'mysql.php');
#Cookies
session_set_cookie_params(86400, ROOT_PATH, $_SERVER['HTTP_HOST'],
osTicket::is_https());
#CURRENT EXECUTING SCRIPT. #CURRENT EXECUTING SCRIPT.
define('THISPAGE', Misc::currentURL()); define('THISPAGE', Misc::currentURL());
define('THISURI', $_SERVER['REQUEST_URI']); define('THISURI', $_SERVER['REQUEST_URI']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment