-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
51 lines (30 loc) · 1.16 KB
/
index.php
File metadata and controls
51 lines (30 loc) · 1.16 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
// Error Reportig konfigurieren
ini_set('error_reporting', -1);
ini_set('display_errors', 1);
// Zeitzone setzen
date_default_timezone_set('Europe/Berlin');
// CSV Line Ending Fix
ini_set('auto_detect_line_endings', true);
// Session starten
session_start();
// Dateien einbinden & Konfiguration laden (nur oberste Installationsebene)
require_once('constants.php');
require_once('includes.php');
require_once('configuration.php');
require_once('errorcodes.php');
// Verbindung herstellen (erfolgt an dieser Stelle um nicht unnötig viele Verbindungen zu öffnen)
$database = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
if($database->connect_errno) { logToFile('mysql-errors', 'Connection Error ' . $database->connect_errno); } // Verbindungsfehler Protokollieren
$database->query("SET NAMES 'utf8'");
// CORS
header("Access-Control-Allow-Methods: GET, POST");
header("Access-Control-Allow-Headers: X-Foo");
header("Access-Control-Max-Age: 3600");
// API Funktionen einbinden
require_once(__PATH__ . '/api-includes.php');
// API ausführen
$api->run();
// Fehler ausgeben
if(isset($_SESSION['errors'])) { unset($_SESSION['errors']); }
?>