<?php
$ip = "127.0.0.1";
$port = "3306";
$username = "tracestockSystem";
$password = "66ZIV+0O(p4m";
$dbname = "tracestock";

// Força o header JSON
header('Content-Type: application/json');

$connected = [];

try {
    $TraceStockDB = new PDO("mysql:host=$ip;port=$port;dbname=$dbname;charset=utf8mb4", $username, $password);
    $TraceStockDB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $connected['dbconnected'] = true;
} catch (PDOException $e) {
    $connected['dbconnected'] = false;
    $connected['error'] = $e->getMessage(); // opcional, só para debug
}
?>