require_once "config.php"; session_start(); $host = $_SERVER['HTTP_HOST']; $slug = $_GET['company'] ?? null; $stmt = $conn->prepare(" SELECT * FROM companies WHERE status=1 AND ( custom_domain = ? OR login_slug = ? ) LIMIT 1 "); $stmt->bind_param("ss", $host, $slug); $stmt->execute(); $res = $stmt->get_result(); if($res->num_rows==0){ die("Invalid Company"); } $company = $res->fetch_assoc(); $_SESSION['company_id'] = $company['id']; $_SESSION['company_name'] = $company['brand_name']; $_SESSION['theme_color'] = $company['primary_color']; $_SESSION['company_type'] = $company['company_type'];