<?php
require_once __DIR__ . '/../config/user_functions.php';

// config/database_ibc.php
// Connessione al database IBC remoto

function ibc_get_connection() {
    $host = '192.168.1.70';
    $user = 'root';
    $pass = 'root1940';
    $db   = 'smproduce_prod';

    $mysqli = @new mysqli($host, $user, $pass, $db);

    if ($mysqli->connect_errno) {
        die('IBC DB connection failed: ' . $mysqli->connect_error);
    }

    $mysqli->set_charset('utf8mb4');
    return $mysqli;
}

// Consente solo nomi tabella/campo con lettere, numeri e underscore
function ibc_valid_identifier($name) {
    return (bool)preg_match('/^[A-Za-z0-9_]+$/', $name);
}
?>
