online-faq/main.inc.php
2020-10-03 20:50:40 +02:00

39 lines
913 B
PHP
Executable File

<?php
/**
* Main file load's all the important files and the autoloader.
* Bindet alles ein und setzt einige Variablen sowie die Datenbank.
*/
require_once __DIR__ . '/classes/Autoloader.class.inc.php';
require_once __DIR__ . '/config.inc.php';
# Registering autoloader
Autoloader::register();
try
{
session_start();
$host = MYSQL_HOST;
$dbname = MYSQL_DB;
# Creates a mysql connection
$pdo = new PDO( "mysql:host={$host};dbname={$dbname}", MYSQL_USER, MYSQL_PASS, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) );
# Set DB connection
Database::setConnection( $pdo );
try {
Api::getRequest();
} catch( Exception $e )
{
# exception ignored
}
}
catch ( Exception $e )
{
# Error occured, please replace it with error template
echo $e->getMessage();
die( 'An internal error occurred in part 1 while processing your request' );
}