<?php
/**
 * Database Configuration
 * RoutexShipping - Logistics Platform
 */

define('DB_HOST', 'localhost');
define('DB_USER', 'routexsh_routex_shipping');
define('DB_PASS', '2}Dj1rg6?T%#I1uz');
define('DB_NAME', 'routexsh_routex_shipping');

// Create connection using PDO
try {
    $pdo = new PDO(
        'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4',
        DB_USER,
        DB_PASS,
        [
            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());
}

// Application constants
define('APP_NAME', 'RoutexShipping');
define('APP_URL', 'http://localhost/routex/');
define('UPLOAD_DIR', dirname(__DIR__) . '/uploads/');
define('ADMIN_EMAIL', 'admin@routexshipping.com');

// Session configuration
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', 0); // Set to 1 in production with HTTPS
ini_set('session.use_strict_mode', 1);

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
