<?php
define('DB_CHARSET', 'utf8mb4');
define('APP_NAME', 'ShopNow');
define('CURRENCY', 'INR');
define('CURRENCY_SYMBOL', '₹');
define('TAX_RATE', 18);
define('STORE_STATE', 'Kerala');
define('SHIPPING_IN_STATE_RATE', 50);
define('SHIPPING_OUT_STATE_RATE', 100);
define('SHIPPING_FREE_MIN_AMOUNT', 500);

$host = $_SERVER['HTTP_HOST'] ?? '';
$isLocal = in_array($host, ['localhost', '127.0.0.1']) || str_starts_with($host, 'localhost:');

if ($isLocal) {
    define('DB_HOST', 'localhost');
    define('DB_NAME', 'ecommerce');
    define('DB_USER', 'root');
    define('DB_PASS', '');
    define('APP_URL', 'http://localhost/News');
    define('BASE_PATH', '/News');
    define('RAZORPAY_KEY_ID', '');
    define('RAZORPAY_KEY_SECRET', '');
    ini_set('session.cookie_secure', 0);
    ini_set('display_errors', 1);
} else {
    // InfinityFree / production
    define('DB_HOST', 'sql123.infinityfree.com');
    define('DB_NAME', 'if0_42123695_ecommerce');
    define('DB_USER', 'if0_42123695');
    define('DB_PASS', 'your_db_password');
    define('APP_URL', 'https://yourdomain.com');
    define('BASE_PATH', '');
    define('RAZORPAY_KEY_ID', 'rzp_test_SynR0ziFbD2JjR');
    define('RAZORPAY_KEY_SECRET', 'jtjt2G5diZI6NCAloG3JE0Gnby');
    ini_set('session.cookie_secure', 1);
    ini_set('display_errors', 0);
}

ini_set('session.cookie_httponly', 1);
ini_set('session.use_only_cookies', 1);

session_start();

error_reporting(E_ALL);
date_default_timezone_set('Asia/Kolkata');
