mirror of
https://github.com/wishthis/wishthis.git
synced 2026-04-22 23:47:20 -04:00
Fix hard coded cookie_domain
This commit is contained in:
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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user