<?php 
// Must comment below on live site.
ini_set('memory_limit', '-1');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// End.

ob_start();
session_start();

include('settings.php');

// spl_autoload_register(function($class){
//   require_once('classes/'.$class.'.php');
// });

spl_autoload_register(function ($class) {
    // Handle your app's own classes in "classes/" directory
    $baseDir = __DIR__ . '/../classes/';
    
    // Skip Composer namespaces like PhpOffice\... or ZipStream\...
    if (strpos($class, '\\') !== false) {
        return;
    }

    $file = $baseDir . $class . '.php';
    if (file_exists($file)) {
        require_once $file;
    }
});

require_once('functions/sanitize.php');

// Set the PHP timezone globally
date_default_timezone_set('America/Toronto'); // Eastern Time (ET), used in Ontario, Quebec, etc.