<?php
session_start();
require_once __DIR__ . '/../src/db.php';

$companyId = (int) ($_GET['id'] ?? 0);

if ($companyId) {
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT * FROM companies WHERE id = ?");
    $stmt->execute([$companyId]);
    $company = $stmt->fetch();
    
    if ($company) {
        $_SESSION['current_company_id'] = $company['id'];
        $_SESSION['current_company'] = $company;
    }
}

header('Location: index.php');
?>
