Upload files to "config"
This commit is contained in:
+16
-4
@@ -1,7 +1,19 @@
|
||||
<?php
|
||||
$conn = mysqli_connect("localhost","root","","pemetaan_kemiskinan");
|
||||
// config/koneksi.php
|
||||
// Versi deploy Coolify. Tetap memakai variabel $conn agar kompatibel dengan kode asli.
|
||||
|
||||
if(!$conn){
|
||||
die("Koneksi gagal");
|
||||
$host = getenv('DB_HOST') ?: 'localhost';
|
||||
$user = getenv('DB_USER') ?: 'root';
|
||||
$pass = getenv('DB_PASS') ?: (getenv('DB_PASSWORD') ?: '');
|
||||
$db = getenv('DB_NAME') ?: 'pemetaan_kemiskinan';
|
||||
$port = (int)(getenv('DB_PORT') ?: 3306);
|
||||
|
||||
$conn = mysqli_connect($host, $user, $pass, $db, $port);
|
||||
|
||||
if (!$conn) {
|
||||
http_response_code(500);
|
||||
die('Koneksi database gagal: ' . mysqli_connect_error());
|
||||
}
|
||||
?>
|
||||
|
||||
mysqli_set_charset($conn, 'utf8mb4');
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user