Dragon-Knight/server/bootstrap.php

63 lines
1.7 KiB
PHP
Raw Normal View History

2024-07-11 18:17:51 -05:00
<?php
2024-07-01 20:53:23 -05:00
2024-07-11 18:17:51 -05:00
// @todo use a flag for this
2024-07-01 20:53:23 -05:00
ini_set('display_errors', 'on');
error_reporting(E_ALL | E_STRICT);
2024-07-11 18:17:51 -05:00
define('START', microtime(true)); // start the timer for this execution
2024-07-01 20:53:23 -05:00
2024-07-15 18:05:35 -05:00
// adjust session settings
ini_set('session.gc_maxlifetime', 604800); // 1 week in seconds
ini_set('session.cookie_lifetime', 604800); // 1 week in seconds
// ensure secure session handling
ini_set('session.use_strict_mode', 1);
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', 1); // only if using HTTPS
// start the session
session_start();
// regenerate session ID to prevent session fixation
if (!isset($_SESSION['initiated'])) {
session_regenerate_id(true);
$_SESSION['initiated'] = true;
}
2024-07-01 20:53:23 -05:00
2024-07-11 18:17:51 -05:00
// @todo move these to a settings config somewhere
2024-07-01 20:53:23 -05:00
const VERSION = '1.1.11';
const BUILD = '';
const DB = SERVER.'/database/dragon.db';
2024-07-11 18:17:51 -05:00
require_once SERVER.'/library.php'; // include our miscellaneous functions
2024-07-11 20:47:39 -05:00
// define whether we are installed or not
define('INSTALLED', file_exists(SERVER.'/.installed'));
2024-07-11 18:17:51 -05:00
// autoloader map
const MAP = [
// 'Class' => 'path/to/class.php',
// server-level classes
'App' => SERVER.'/app/App.php',
'Database' => SERVER.'/app/Database.php',
'Request' => SERVER.'/app/Request.php',
'Auth' => SERVER.'/app/Auth.php',
2024-07-11 18:17:51 -05:00
// modules
2024-07-11 21:17:06 -05:00
'HomeModule' => SERVER.'/modules/HomeModule.php',
'InstallModule' => SERVER.'/modules/InstallModule.php',
'GateModule' => SERVER.'/modules/GateModule.php',
2024-07-13 23:15:25 -05:00
// models
'Classes' => SERVER.'/models/Classes.php',
'Player' => SERVER.'/models/Player.php',
'Spell' => SERVER.'/models/Spell.php',
'Session' => SERVER.'/models/Session.php',
2024-07-11 18:17:51 -05:00
];
// autoloader
spl_autoload_register(function($class) {
if (isset(MAP[$class])) require_once MAP[$class];
});