avm99963 | 7099538 | 2020-09-23 01:03:01 +0200 | [diff] [blame] | 1 | <?php |
| 2 | // core.php - El fitxer més elemental, estimat Watson |
| 3 | |
| 4 | // Get settings |
| 5 | require(__DIR__.'/config.php'); |
| 6 | |
| 7 | // Set composer |
| 8 | require(__DIR__.'/vendor/autoload.php'); |
| 9 | |
| 10 | // Set timezone and locale accordingly |
| 11 | date_default_timezone_set('Europe/Madrid'); |
| 12 | |
| 13 | // Connect to the DB |
| 14 | $con = new PDO('mysql:host='.$conf['db']['host'].';dbname='.$conf['db']['database'].';charset=utf8mb4', $conf['db']['user'], $conf['db']['password']); |
| 15 | |
| 16 | // Session settings |
avm99963 | 5a2490b | 2020-09-28 23:14:27 +0200 | [diff] [blame^] | 17 | if(PHP_VERSION_ID < 70300) { |
| 18 | session_set_cookie_params(0, ($conf['path'] ?? '/').'; samesite=None', $_SERVER['HTTP_HOST'], $conf['isProduction'], true); |
| 19 | } else { |
| 20 | session_set_cookie_params([ |
| 21 | 'lifetime' => 0, |
| 22 | 'path' => ($conf['path'] ?? '/'), |
| 23 | 'secure' => ($conf['isProduction']), |
| 24 | 'httponly' => true, |
| 25 | 'samesite' => 'None' |
| 26 | ]); |
| 27 | } |
| 28 | |
avm99963 | 7099538 | 2020-09-23 01:03:01 +0200 | [diff] [blame] | 29 | session_start(); |