<?php
// Generated by setup_mariadb_project.sh — edit as needed.
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'app_38471');
define('DB_USER', 'app_38471');
define('DB_PASS', 'e1f9b5b3-fcef-4c8d-87d2-8630b1f72491');

function db() {
  static $pdo;
  if (!$pdo) {
    $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    ]);
    if (session_status() === PHP_SESSION_NONE && !headers_sent()) {
        @session_start();
    }
    if (isset($_SESSION['outlet_id'])) {
        $pdo->exec("SET @session_outlet_id = " . (int)$_SESSION['outlet_id']);
    } else {
        $pdo->exec("SET @session_outlet_id = 0");
    }
  }
  return $pdo;
}
