-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinitpage_inc.php
More file actions
29 lines (19 loc) · 812 Bytes
/
initpage_inc.php
File metadata and controls
29 lines (19 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
//---[Logovani]-------------------------------------------------------------------
use Katzgrau\KLogger\Logger;
$logger = new Katzgrau\KLogger\Logger($conf['log_dir'], Psr\Log\LogLevel::DEBUG, array (
'filename' => $conf['log_filename']
)
);
//---[Session]-------------------------------------------------------------------
if (!isset($_SESSION)) session_start(); // zahájení relace session
//---[DB]-----------------------------------------------------------------------
// PDO
try {
$db = new PDO("mysql:host=".$conf['dbhost'].";dbname=".$conf['dbname'].";charset=utf8", $conf['dbuser'], $conf['dbpasswd']);
$db->exec("set names utf8");
$logger->info("pripojeni k db je ok");
} catch (PDOException $e) {
$logger->error("Chyba pri pripojeni k databazi. ".$e->getMessage());
die();
}