Fix hard coded cookie_domain
This commit is contained in:
parent
5ae647ebf5
commit
7d5fe7eadc
1 changed files with 22 additions and 10 deletions
32
index.php
32
index.php
|
@ -37,9 +37,30 @@ spl_autoload_register(
|
|||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Config
|
||||
*/
|
||||
$configPath = __DIR__ . '/' . 'src/config/config.php';
|
||||
|
||||
if (file_exists($configPath)) {
|
||||
require $configPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Session
|
||||
*/
|
||||
$cookie_domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
if (defined('CHANNELS') && is_iterable(CHANNELS)) {
|
||||
foreach (CHANNELS as $channel) {
|
||||
if ('stable' === $channel['branch']) {
|
||||
$cookie_domain = $channel['host'];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sessionLifetime = 2592000 * 12; // 12 Months
|
||||
|
||||
session_start(
|
||||
|
@ -47,7 +68,7 @@ session_start(
|
|||
'name' => 'wishthis',
|
||||
'cookie_lifetime' => $sessionLifetime,
|
||||
'cookie_path' => '/',
|
||||
'cookie_domain' => '.wishthis.online',
|
||||
'cookie_domain' => '.' . $cookie_domain,
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -56,15 +77,6 @@ if (!isset($_SESSION['user']) || is_array($_SESSION['user'])) {
|
|||
$_SESSION['user'] = new User();
|
||||
}
|
||||
|
||||
/**
|
||||
* Config
|
||||
*/
|
||||
$configPath = __DIR__ . '/' . 'src/config/config.php';
|
||||
|
||||
if (file_exists($configPath)) {
|
||||
require $configPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue