blob: c4f1af5b3248f7ff0642b93f858ca51fb72f96f3 [file] [log] [blame]
avm9996370995382020-09-23 01:03:01 +02001<?php
2// core.php - El fitxer més elemental, estimat Watson
3
4// Get settings
5require(__DIR__.'/config.php');
6
7// Set composer
8require(__DIR__.'/vendor/autoload.php');
9
10// Set timezone and locale accordingly
11date_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
avm999635a2490b2020-09-28 23:14:27 +020017if(PHP_VERSION_ID < 70300) {
avm99963449d4322020-09-28 23:22:37 +020018 session_set_cookie_params(0, ($conf['path'] ?? '/').'; SameSite=None', $_SERVER['HTTP_HOST'], $conf['isProduction'], true);
avm999635a2490b2020-09-28 23:14:27 +020019} 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
avm9996370995382020-09-23 01:03:01 +020029session_start();