<?php
global $CONFIG; try{ $dsn=sprintf('mysql:host=%s;port=%d;dbname=%s;charset=utf8mb4',$CONFIG['DB_HOST'],$CONFIG['DB_PORT'],$CONFIG['DB_NAME']); $DB=new PDO($dsn,$CONFIG['DB_USER'],$CONFIG['DB_PASS'],[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_ASSOC]); } catch (Throwable $e){ http_response_code(500); echo 'DB error: '.htmlspecialchars($e->getMessage()); exit; }
