<?php

/**
 * A simple, clean and secure login / user authentication solution embedded into a small PHP framework.
 * Part of a set of login scripts, more on http://www.php-login.net
 *
 * PHP LOGIN (FRAMEWORK VERSION) 2.1 (in development)
 *
 * @author Panique
 * @link http://www.php-login.net/
 * @link https://github.com/panique/php-login/
 * @license http://opensource.org/licenses/MIT MIT License
 */

error_reporting(E_ALL);
//ini_set("display_errors", 1);
ini_set("error_log", "/var/www/html/cryptet/logs/www-php-errors.log");
date_default_timezone_set('UTC');

if (isset($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'], 0, 4) === 'www.') {
	$https = isset($_SERVER['HTTPS']) ||
			(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'HTTPS') == 0);
	header('Location: http' . ($https ? 's' : '') . '://' . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
	exit;
}

// Auto-loading the classes (currently only from application/libs) via Composer's PSR-4 autoloader
// Later it might be useful to use a namespace here, but for now let's keep it as simple as possible
require '../vendor/autoload.php';

// Start our application
new Application();
