40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
// config/db.php
|
|
// Centralized Database Connection Configuration
|
|
|
|
// Database 1: HOSxP (External)
|
|
$host1 = "10.0.250.250";
|
|
$username1 = "dmstele";
|
|
$password1 = "dmstele10742";
|
|
$db1 = "hos";
|
|
|
|
// Database 2: Local Web Service
|
|
$host2 = "localhost";
|
|
$username2 = "root";
|
|
$password2 = "@Samui@1074200";
|
|
$db2 = "hosxp_webservice";
|
|
|
|
// Disable MySQLi exceptions to maintain compatibility with legacy code that checks for false
|
|
mysqli_report(MYSQLI_REPORT_OFF);
|
|
|
|
try {
|
|
// Create connection to HOSxP Database
|
|
$conn1 = new mysqli($host1, $username1, $password1, $db1);
|
|
$conn1->set_charset("utf8");
|
|
|
|
// Create connection to Local Web Service Database
|
|
$conn2 = new mysqli($host2, $username2, $password2, $db2);
|
|
$conn2->set_charset("utf8");
|
|
|
|
} catch (mysqli_sql_exception $e) {
|
|
// Log the error securely and show a generic message
|
|
error_log("Database Connection Error: " . $e->getMessage());
|
|
die("ไม่สามารถเชื่อมต่อฐานข้อมูลได้ในขณะนี้ กรุณาติดต่อผู้ดูแลระบบ");
|
|
}
|
|
|
|
// Application Security Key for AES Encryption
|
|
if (!defined('APP_KEY')) {
|
|
define('APP_KEY', 'HOSxP_Web_Service_Secret_Key_2026!');
|
|
}
|
|
?>
|