-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
22 lines (18 loc) · 724 Bytes
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
session_name("twProject");
session_start();
// settings and config
if ($_SERVER['SERVER_NAME'] === "localhost") {
require_once("mysql_config.php");
} else {
require_once("../../private/mysql_config_prod.php");
}
// database related object
require_once("model/Database.php");
require_once("model/PandemicStorageMySQL.php");
require_once("model/UserStorageMySQL.php");
$pdo = new PDO("mysql:host=" . MYSQL_HOST . ";port=" . MYSQL_PORT . ";dbname=" . MYSQL_DB . ";charset=utf8", MYSQL_USER, MYSQL_PASSWORD);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db = new Database();
$db->addStorage("pandemics", new PandemicStorageMySQL($pdo));
$db->addStorage("users", new UserStorageMySQL($pdo));