📂 FileMgr
📍
/home/u625410797/domains/monothailand.com/public_html/config
✏️ Edit File: /home/u625410797/domains/monothailand.com/public_html/config/config.php
⬅ Kembali
<?php /** * Monothailand PHP Version - Global Configuration * ============================================================ * ไฟล์ตั้งค่าหลักของระบบ ห้ามเปิดเผย credentials ใน public repo */ // ป้องกันการเข้าถึงไฟล์โดยตรง if (!defined('MONO_APP')) { define('MONO_APP', true); } // ============================================================ // Environment // ============================================================ // Auto-detect environment based on domain or set manually via APP_ENV $host = $_SERVER['HTTP_HOST'] ?? 'localhost'; $isProductionDomain = (strpos($host, 'monothailand.com') !== false || strpos($host, 'www.monothailand.com') !== false); define('APP_ENV', getenv('APP_ENV') ?: ($isProductionDomain ? 'production' : 'development')); define('APP_DEBUG', APP_ENV === 'development'); // ============================================================ // Database Configuration // ============================================================ if (APP_ENV === 'production') { // Production Database (Real Hosting) define('DB_HOST', 'localhost'); // or your production host define('DB_NAME', 'u625410797_monothailand_1'); define('DB_USER', 'u625410797_monothailand_1'); define('DB_PASS', 'JH9D&w:>I0+x'); } else { // Development Database (Localhost XAMPP) define('DB_HOST', 'localhost'); define('DB_NAME', 'monothailand'); define('DB_USER', 'root'); define('DB_PASS', ''); } define('DB_CHARSET', 'utf8mb4'); // ============================================================ // Path Configuration // ============================================================ define('BASE_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR); // Points to monothailand root define('INCLUDES_PATH', BASE_PATH . 'includes' . DIRECTORY_SEPARATOR); define('PUBLIC_PATH', BASE_PATH . 'public' . DIRECTORY_SEPARATOR); define('UPLOADS_PATH', BASE_PATH . 'uploads' . DIRECTORY_SEPARATOR); define('VIEWS_PATH', BASE_PATH . 'views' . DIRECTORY_SEPARATOR); define('CONFIG_PATH', BASE_PATH . 'config' . DIRECTORY_SEPARATOR); define('MIDDLEWARE_PATH', INCLUDES_PATH . 'middleware' . DIRECTORY_SEPARATOR); define('ASSETS_PATH', BASE_PATH . 'assets' . DIRECTORY_SEPARATOR); // ============================================================ // URL Configuration - Separate for localhost vs production // ============================================================ if (APP_ENV === 'production') { // Production: Use fixed domain define('BASE_URL', 'https://monothailand.com/'); define('PUBLIC_URL', 'https://monothailand.com/'); define('ADMIN_URL', 'https://monothailand.com/admin/'); define('UPLOADS_URL', 'https://monothailand.com/uploads/'); define('ASSETS_URL', 'https://monothailand.com/assets/'); define('API_URL', 'https://monothailand.com/api/'); } else { // Development: Auto-detect from current server $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $host = $_SERVER['HTTP_HOST'] ?? 'localhost'; // Auto-detect root path based on SCRIPT_NAME $scriptName = dirname($_SERVER['SCRIPT_NAME'] ?? ''); $rootPath = ($scriptName === '/' || $scriptName === '\\') ? '/' : rtrim($scriptName, '/') . '/'; define('BASE_URL', $protocol . '://' . $host . $rootPath); define('PUBLIC_URL', $protocol . '://' . $host . $rootPath); define('ADMIN_URL', BASE_URL . 'admin/'); define('UPLOADS_URL', BASE_URL . 'uploads/'); define('ASSETS_URL', BASE_URL . 'assets/'); define('API_URL', BASE_URL . 'api/'); } // ============================================================ // Security // ============================================================ define('CSRF_TOKEN_NAME', 'mono_csrf_token'); define('SESSION_NAME', 'mono_session'); define('HASH_COST', 12); // bcrypt cost factor // ============================================================ // Upload Settings // ============================================================ define('MAX_UPLOAD_SIZE', 5 * 1024 * 1024); // 5MB define('ALLOWED_IMAGE_TYPES', ['image/jpeg', 'image/png', 'image/webp', 'image/gif']); define('ALLOWED_IMAGE_EXTS', ['jpg', 'jpeg', 'png', 'webp', 'gif']); // ============================================================ // Pagination // ============================================================ define('PRODUCTS_PER_PAGE', 12); define('ADMIN_PER_PAGE', 20); // ============================================================ // Error Handling // ============================================================ if (APP_DEBUG) { error_reporting(E_ALL); ini_set('display_errors', '1'); } else { error_reporting(0); ini_set('display_errors', '0'); ini_set('log_errors', '1'); ini_set('error_log', BASE_PATH . 'logs/error.log'); } // ============================================================ // Timezone // ============================================================ date_default_timezone_set('Asia/Bangkok'); // ============================================================ // Load Helpers // ============================================================ if (!defined('MONO_FUNCTIONS_LOADED')) { define('MONO_FUNCTIONS_LOADED', true); require_once INCLUDES_PATH . 'functions.php'; } ?>
💾 Simpan File
Batal
⬅ Naik ke public_html
1 item
Nama
Tipe
Ukuran
Diubah
Aksi
🐘
config.php
php
5.2 KB
2026-05-31 16:39
✏️ Edit
👁️ View
🗑 Hapus