<?php
if (!defined('BASE_URL')) {
    $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';
    $host = $_SERVER['HTTP_HOST'] ?? 'localhost';
    define('BASE_URL', $scheme . $host . '/');
}

ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);

$servername  = "localhost";
$username_db = "storism1_NLuser";
$password_db = "NLelectromenagerpassword";
$dbname      = "storism1_NL_db";

try {
    $pdo = new PDO(
        "mysql:host=$servername;dbname=$dbname;charset=utf8mb4",
        $username_db,
        $password_db,
        [
            PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            PDO::ATTR_EMULATE_PREPARES   => false,
        ]
    );
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}

$connect = new mysqli($servername, $username_db, $password_db, $dbname);
$conn    = $connect;
if ($connect->connect_error) {
    die("MySQL connection failed: " . $connect->connect_error);
}
?>
