19 lines
468 B
PHP
19 lines
468 B
PHP
<?php
|
|
require 'db.php';
|
|
require 'auth.php';
|
|
|
|
header('Content-Type: application/json');
|
|
require_login();
|
|
|
|
$user_id = current_user_id();
|
|
|
|
$stmt = $pdo->prepare("SELECT id, name, is_default FROM profiles WHERE user_id = ? ORDER BY is_default DESC, name ASC");
|
|
$stmt->execute([$user_id]);
|
|
$profiles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'active_profile_id' => $_SESSION['active_profile_id'] ?? null,
|
|
'profiles' => $profiles
|
|
]);
|