Add temp import script + update koneksi.php

This commit is contained in:
Athallah Ghathfan Aqila
2026-06-11 14:27:38 +07:00
parent 6215b4367a
commit 0f1c4e50a0
2 changed files with 39 additions and 1 deletions
+6 -1
View File
@@ -1,8 +1,13 @@
<?php
if (isset($conn)) return;
$host = getenv('DB_HOST') ?: '127.0.0.1';
$user = getenv('DB_USER') ?: 'root';
$pass = getenv('DB_PASS') ?: '';
$name = getenv('DB_NAME') ?: 'db_webgis';
$port = (int)(getenv('DB_PORT') ?: 3306);
$conn = mysqli_init();
mysqli_options($conn, MYSQLI_OPT_CONNECT_TIMEOUT, 5);
$ok = @mysqli_real_connect($conn, '127.0.0.1', 'root', '', 'db_webgis', 3306);
$ok = @mysqli_real_connect($conn, $host, $user, $pass, $name, $port);
if (!$ok) {
header('Content-Type: application/json');
die(json_encode(['status' => 'error', 'message' => 'Koneksi DB gagal: ' . mysqli_connect_error()]));