<?php
// config.php (keep this outside webroot if possible)

define('DB_HOST', 'localhost');
define('DB_USER', 'u427625983_schoolinmycity');     // replace if different
define('DB_PASS', 'K#$%^tfvgyt657guvgGG');             // replace if different
define('DB_NAME', 'u427625983_schoolinmycity'); // replace if different
define('DB_CHARSET', 'utf8mb4');

// PayPal sandbox credentials (replace with your sandbox keys)
define('PAYPAL_CLIENT_ID', 'AfTKIvUFjaDpt8BpDfGekGy_rcxvtPyicc9Elxt0xHZFtvRwRrj26HhDDzIop163ryHdswo72eJk9GPe');
define('PAYPAL_SECRET', 'EJWq4A5L8-NMJ2nV2rNz4nGioWhshxKQVwx89K9Z4TuXGt-xE3jA1DcHqm9UPrMxuCFiSN7QZVHiSna8');

define('RAZORPAY_KEY_ID', 'rzp_live_RTGXLVJhHeH7de');
define('RAZORPAY_SECRET', 'xtcR2krGgbl6PmgazOqTBwBJ');

// Stripe Configuration
define('STRIPE_PUBLISHABLE_KEY', 'pk_live_51MUPOkSDX9TVziH5KADvKZC4JDLvPpjmPGn6wQZEKtBHKsWHIBAXHWPfpb8LsexZEtXmfMzEkaVtfZhzfrgXSo9w00mjNLlLWC'); // Replace with your actual key
define('STRIPE_SECRET_KEY', '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'); // Replace with your actual key
define('STRIPE_WEBHOOK_SECRET', 'rk_test_51MUPOkSDX9TVziH5wi8mlzLVlMsO3J77wzgPtFkOEARWiWXvn1T5FVuzFw7sJcP1JjvyUnKgaxTluSqhaWAa0GQF0063EwEEaX'); // Replace with your webhook secret

// Site Configuration
define('SITE_URL', 'https://schoolinmycity.com/');
define('STRIPE_SUCCESS_URL', SITE_URL . '/stripe_success.php');
define('STRIPE_CANCEL_URL', SITE_URL . '/stripe_cancel.php');

// PayPal base URLs
// define('PAYPAL_BASE', 'https://api-m.sandbox.paypal.com'); // sandbox
define('PAYPAL_BASE', 'https://api-m.paypal.com'); // live
// for production use: https://api-m.paypal.com

// helper function: DB connection
function db_connect(){
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    if ($mysqli->connect_error) {
        error_log("DB connect error: " . $mysqli->connect_error);
        http_response_code(500);
        die(json_encode(['error'=>'Database connection failed']));
    }
    $mysqli->set_charset(DB_CHARSET);
    return $mysqli;
}
